From 95b28c63b6089c05847dc25b485ad166f6ce4df9 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Thu, 22 Oct 2026 10:54:19 -0700 Subject: [PATCH 01/13] Fix XSS in color field explanations Escape dataset column names and column types before interpolating color explanation HTML. Cover palette and direct-color explanations with focused regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2ae73b8-dd6e-41ac-821c-57c902c74b9e --- packages/sanddance-explorer/package.json | 1 + packages/sanddance-explorer/src/language.ts | 12 +++- packages/sanddance-explorer/test/language.cjs | 68 +++++++++++++++++++ 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 packages/sanddance-explorer/test/language.cjs diff --git a/packages/sanddance-explorer/package.json b/packages/sanddance-explorer/package.json index cb525c84d..50dc8e4c3 100644 --- a/packages/sanddance-explorer/package.json +++ b/packages/sanddance-explorer/package.json @@ -13,6 +13,7 @@ "dist" ], "scripts": { + "test": "mocha --extension cjs", "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "build-typescript": "tsc -p .", "watch-typescript": "tsc -p . -w", diff --git a/packages/sanddance-explorer/src/language.ts b/packages/sanddance-explorer/src/language.ts index 1dcf351a2..d56fd32c8 100644 --- a/packages/sanddance-explorer/src/language.ts +++ b/packages/sanddance-explorer/src/language.ts @@ -3,6 +3,14 @@ * Licensed under the MIT License. */ +function escapeHtml(value: string) { + return value.replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + export const strings = { appName: 'SandDance', bingsearch: 'Bing', @@ -120,9 +128,9 @@ export const strings = { labelColorOptions: 'Color options', labelColorBinExplanation: 'For numeric columns', labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount) => - `Field ${colorColumnName} is of type ${colorColumnType}${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ''}.`, + `Field ${escapeHtml(colorColumnName)} is of type ${escapeHtml(colorColumnType)}${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ''}.`, labelColorFieldIsColorData: (colorColumnName) => - `Field ${colorColumnName} contains direct color data.`, + `Field ${escapeHtml(colorColumnName)} contains direct color data.`, labelColorBinNone: 'None (continuous)', labelColorBinQuantize: 'Quantize', labelColorBinQuantile: 'Quantile', diff --git a/packages/sanddance-explorer/test/language.cjs b/packages/sanddance-explorer/test/language.cjs new file mode 100644 index 000000000..3e0f3edc3 --- /dev/null +++ b/packages/sanddance-explorer/test/language.cjs @@ -0,0 +1,68 @@ +/*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ + +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const ts = require('typescript'); + +const source = fs.readFileSync(path.join(__dirname, '..', 'src', 'language.ts'), 'utf8'); +const { outputText } = ts.transpileModule(source, { + compilerOptions: { module: ts.ModuleKind.CommonJS }, +}); +const context = { exports: {} }; +vm.runInNewContext(outputText, context); +const { strings } = context.exports; + +describe('Color field explanations', function () { + const maliciousName = ''; + const encodedName = '<img src=x onerror="alert(1)">'; + + it('escapes malicious column names in the palette explanation', function () { + assert.equal( + strings.labelColorFieldInfo(maliciousName, 'integer', true, 2), + `Field ${encodedName} is of type integer and has 2 distinct values.`, + ); + }); + + it('escapes malicious column names in the direct-color explanation', function () { + assert.equal( + strings.labelColorFieldIsColorData(maliciousName), + `Field ${encodedName} contains direct color data.`, + ); + }); + + it('preserves literal entities, ampersands, and quotes in both explanations', function () { + const name = 'A & B < "C" > \'D\' <img>'; + const encoded = 'A & B < "C" > 'D' &lt;img&gt;'; + assert.equal( + strings.labelColorFieldInfo(name, 'number', false, 100), + `Field ${encoded} is of type number.`, + ); + assert.equal( + strings.labelColorFieldIsColorData(name), + `Field ${encoded} contains direct color data.`, + ); + }); + + it('escapes the column type as text', function () { + assert.equal( + strings.labelColorFieldInfo('Revenue', maliciousName, false, 0), + `Field Revenue is of type ${encodedName}.`, + ); + }); + + it('preserves ordinary names and explanation formatting', function () { + assert.equal( + strings.labelColorFieldInfo('Revenue', 'integer', true, 3), + 'Field Revenue is of type integer and has 3 distinct values.', + ); + assert.equal( + strings.labelColorFieldIsColorData('Color'), + 'Field Color contains direct color data.', + ); + }); +}); From 47d4177f72232d1ea823348a49c7fe8604bbeed7 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Thu, 22 Oct 2026 12:49:55 -0700 Subject: [PATCH 02/13] version patch --- extensions/vscode-sanddance/package.json | 2 +- packages/powerbi/pbiviz.json | 2 +- packages/sanddance-embed/package.json | 2 +- packages/sanddance-explorer/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/vscode-sanddance/package.json b/extensions/vscode-sanddance/package.json index 444187819..e74951997 100644 --- a/extensions/vscode-sanddance/package.json +++ b/extensions/vscode-sanddance/package.json @@ -2,7 +2,7 @@ "name": "vscode-sanddance", "displayName": "SandDance for VSCode", "description": "Visually explore, understand, and present your data.", - "version": "4.2.0", + "version": "4.2.1", "icon": "sanddance-logo.png", "publisher": "msrvida", "license": "MIT", diff --git a/packages/powerbi/pbiviz.json b/packages/powerbi/pbiviz.json index 71b85f128..cfe394e65 100644 --- a/packages/powerbi/pbiviz.json +++ b/packages/powerbi/pbiviz.json @@ -4,7 +4,7 @@ "displayName": "SandDance", "guid": "SandDance201929976D117A654D0BAB8E96507442D80B", "visualClassName": "Visual", - "version": "4.2.0.2", + "version": "4.2.0.3", "description": "Visually explore, understand, and present your data.", "supportUrl": "https://github.com/Microsoft/SandDance/issues", "gitHubUrl": "https://github.com/microsoft/SandDance" diff --git a/packages/sanddance-embed/package.json b/packages/sanddance-embed/package.json index 2cbc0c7f5..9d6d1bdb9 100644 --- a/packages/sanddance-embed/package.json +++ b/packages/sanddance-embed/package.json @@ -1,6 +1,6 @@ { "name": "@msrvida/sanddance-embed", - "version": "4.5.0", + "version": "4.5.1", "description": "Embeddable SandDance Explorer.", "browser": "dist/umd/sanddance-embed.js", "repository": { diff --git a/packages/sanddance-explorer/package.json b/packages/sanddance-explorer/package.json index 50dc8e4c3..a7fa60d8e 100644 --- a/packages/sanddance-explorer/package.json +++ b/packages/sanddance-explorer/package.json @@ -1,6 +1,6 @@ { "name": "@msrvida/sanddance-explorer", - "version": "4.1.8", + "version": "4.1.9", "description": "SandDance data exploration React component.", "main": "dist/es6/index.js", "repository": { From abb4ab11d03597e0061881675074e45c6a6218cf Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Thu, 22 Oct 2026 13:02:39 -0700 Subject: [PATCH 03/13] version bump --- package-lock.json | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index b57899f06..be22a3583 100644 --- a/package-lock.json +++ b/package-lock.json @@ -98,7 +98,7 @@ "license": "MIT" }, "extensions/vscode-sanddance": { - "version": "4.2.0", + "version": "4.2.1", "license": "MIT", "engines": { "vscode": "^1.53.0" @@ -7412,6 +7412,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "prr": "~1.0.1" }, @@ -9500,6 +9501,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "bin": { "image-size": "bin/image-size.js" }, @@ -10748,6 +10750,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "pify": "^4.0.1", "semver": "^5.6.0" @@ -10763,6 +10766,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "engines": { "node": ">=6" } @@ -10774,6 +10778,7 @@ "dev": true, "license": "ISC", "optional": true, + "peer": true, "bin": { "semver": "bin/semver" } @@ -10785,6 +10790,7 @@ "dev": true, "license": "BSD-3-Clause", "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -11897,6 +11903,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "iconv-lite": "^0.6.3", "sax": "^1.2.4" @@ -13531,7 +13538,8 @@ "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", "dev": true, "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/public-encrypt": { "version": "4.0.3", @@ -18204,7 +18212,7 @@ }, "packages/sanddance-embed": { "name": "@msrvida/sanddance-embed", - "version": "4.5.0", + "version": "4.5.1", "license": "MIT", "dependencies": { "@msrvida/sanddance-explorer": "^4" @@ -18212,7 +18220,7 @@ }, "packages/sanddance-explorer": { "name": "@msrvida/sanddance-explorer", - "version": "4.1.8", + "version": "4.1.9", "license": "MIT", "dependencies": { "@msrvida/chart-recommender": "^4", From 6c83dbadeac385b4d0965efdda785c19f5fc0519 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Thu, 22 Oct 2026 13:03:00 -0700 Subject: [PATCH 04/13] version bump --- packages/powerbi/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/powerbi/package-lock.json b/packages/powerbi/package-lock.json index b75f9d5ba..bfb1b8993 100644 --- a/packages/powerbi/package-lock.json +++ b/packages/powerbi/package-lock.json @@ -41,7 +41,7 @@ }, "../sanddance-explorer": { "name": "@msrvida/sanddance-explorer", - "version": "4.1.8", + "version": "4.1.9", "license": "MIT", "dependencies": { "@msrvida/chart-recommender": "^4", From ad13bf2da2e42410ec6612ab21a7fe1001d7d162 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 14:18:35 -0700 Subject: [PATCH 05/13] version bump --- packages/powerbi/src/version.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/powerbi/src/version.ts b/packages/powerbi/src/version.ts index 8ad18d86c..28e951a24 100644 --- a/packages/powerbi/src/version.ts +++ b/packages/powerbi/src/version.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -export const version: string = '4.2.0.2'; +export const version: string = '4.2.0.3'; From bfa1324d3269d6c74a7f74c481d0cdd4649d345f Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 14:19:05 -0700 Subject: [PATCH 06/13] Update postinstall script to install Power BI visual dependencies correctly --- dev.md | 11 +++++++++++ package-lock.json | 7 +++---- package.json | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dev.md b/dev.md index 0b7d8a28b..c3e2cd34b 100644 --- a/dev.md +++ b/dev.md @@ -21,6 +21,17 @@ The SandDance repo is a monorepo made up of several packages, managed by npm wor 1. `npm install` 1. [Install Jekyll](https://jekyllrb.com/) to run the website locally. +The root install hook also installs the Power BI visual's dependencies locally with +`--workspaces=false`. Power BI's packaging tools require `powerbi-visuals-api` in +the visual's own `node_modules` directory; a hoisted workspace installation is not +sufficient. If install scripts were skipped, run +`cd packages/powerbi` followed by `npm install --prefix=. --workspaces=false` +before building. + +Use the npm version bundled with your Node.js installation. With Node.js 24, +npm 8.15 can fail during this standalone install with +`Cannot set properties of null (setting 'dev')`; npm 11 completes it successfully. + ## Build 1. `npm run build` diff --git a/package-lock.json b/package-lock.json index be22a3583..f20f7decc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13152,10 +13152,9 @@ "license": "MIT" }, "node_modules/powerbi-visuals-api": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/powerbi-visuals-api/-/powerbi-visuals-api-5.11.0.tgz", - "integrity": "sha512-OWvhexc4Dqz4swiQiZLnGj+NWUoX84metePeRw5Or3wG3lN/0x6Yd3xqJwBH67uYyjqQ/eomuF7lvbryxCqTbQ==", - "license": "MIT", + "version": "5.11.1", + "resolved": "https://registry.npmjs.org/powerbi-visuals-api/-/powerbi-visuals-api-5.11.1.tgz", + "integrity": "sha512-sAdzhUPEXylS3ad+RSoU+RmkT6KguoEo0DJ0SsSt0TOSpQH2vI3nPmXusb2RWH3XpsB7UufYV+d4Cgp0OMAKFw==", "dependencies": { "semver": "^7.6.0" } diff --git a/package.json b/package.json index 99f0967ed..1f755be05 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "vegatest": "npm run vegatest --workspaces --if-present", "eslint": "npm run eslint --workspaces --if-present", "build-az": "npm run build --workspace azdata-sanddance", - "postinstall": "node ./scripts/copy_inuitcss.js && cd packages/powerbi && npm install --prefix . && cd ../..", + "postinstall": "node ./scripts/copy_inuitcss.js && cd packages/powerbi && npm install --prefix=. --workspaces=false && cd ../..", "build:01": "npm run build:01 --workspaces --if-present", "build:02": "npm run build:02 --workspaces --if-present", "build:03": "npm run build:03 --workspaces --if-present", From 654110d1c2af286fb890160d525b500698e221a5 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 15:12:55 -0700 Subject: [PATCH 07/13] Update @vscode/vsce to version 4.0.0 and allow scripts for vsce-sign --- package-lock.json | 2622 +++++++++------------------------------------ package.json | 5 +- 2 files changed, 521 insertions(+), 2106 deletions(-) diff --git a/package-lock.json b/package-lock.json index f20f7decc..a48c3e99c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "@typescript-eslint/eslint-plugin": "^8.33.1", "@typescript-eslint/parser": "^8.33.1", "@uifabric/styling": "^7.25.1", - "@vscode/vsce": "^3.6.0", + "@vscode/vsce": "^4.0.0", "core-js": "3.2.1", "d3-color": "^3.1.0", "d3-ease": "^1.0.5", @@ -104,40 +104,23 @@ "vscode": "^1.53.0" } }, - "node_modules/@azu/format-text": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@azu/format-text/-/format-text-1.0.2.tgz", - "integrity": "sha512-Swi4N7Edy1Eqq82GxgEECXSSLyn6GOb5htRFPzBDdUkECGXtlf12ynO5oJSpWKPwCaUssOu7NfhDcCWpIC6Ywg==", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/@azu/style-format": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@azu/style-format/-/style-format-1.0.1.tgz", - "integrity": "sha512-AHcTojlNBdD/3/KxIKlg8sxIWHfOtQszLvOpagLTO+bjC3u7SAszu1lf//u7JJC50aUSH+BVWDD/KvaA6Gfn5g==", - "dev": true, - "license": "WTFPL", - "dependencies": { - "@azu/format-text": "^1.0.1" - } - }, "node_modules/@azure/abort-controller": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", - "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.2.0.tgz", + "integrity": "sha512-fNAjWnA/nZ2jz31kxR/AqRaUT8ewHBw/WuBIosK0moMy1C9e5ValbDfFdIxJzVOOYaYkV/b2F1S4H/aHiqfVQg==", "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=22.0.0" } }, "node_modules/@azure/core-auth": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.10.1.tgz", - "integrity": "sha512-ykRMW8PjVAn+RS6ww5cmK9U2CyH9p4Q88YJwvUslfuMmN98w/2rdGRLPqJYObapBCdzBVeDgYWdJnFPFb7qzpg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.11.0.tgz", + "integrity": "sha512-IUZydyTUkDnYdstOW9pFOOUQlBjAepK5teihDE3x6yxsPJs/hsAaaYpeGxdxrgtOiJbBKSjKW7MDk7AEhb4LRg==", "dev": true, "license": "MIT", "dependencies": { @@ -146,13 +129,13 @@ "tslib": "^2.6.2" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } }, "node_modules/@azure/core-client": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.10.1.tgz", - "integrity": "sha512-Nh5PhEOeY6PrnxNPsEHRr9eimxLwgLlpmguQaHKBinFYA/RU9+kOYVOQqOrTsCL+KSxrLLl1gD8Dk5BFW/7l/w==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.11.1.tgz", + "integrity": "sha512-2QygG2F76ZpMP2eMztiJvAiFMu71M9rDeU7vO/QKg5Css7MgM4frUOslFjhVjRhbGaCNPtz/S8M6y46/fFKVuQ==", "dev": true, "license": "MIT", "dependencies": { @@ -165,13 +148,23 @@ "tslib": "^2.6.2" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" + } + }, + "node_modules/@azure/core-process": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@azure/core-process/-/core-process-1.0.0.tgz", + "integrity": "sha512-/shnJ+ooO8WPxDhPEeI/2oRQuubn16gZ6CvlbpWbEswZfzwI9tI/sMAHmF3x1LuQ9yZYXfLW3TjzGMLEC5blKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.0.0" } }, "node_modules/@azure/core-rest-pipeline": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.22.2.tgz", - "integrity": "sha512-MzHym+wOi8CLUlKCQu12de0nwcq9k9Kuv43j4Wa++CsCpJwps2eeBQwD2Bu8snkxTtDKDx4GwjuR9E8yC8LNrg==", + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.25.0.tgz", + "integrity": "sha512-bMs8ekJLjX8wPV+9IPBges1SLPyuDtE9g5gLDWOpxzKcoOFQnpLGkbcT1tdw3FaAmDS1gnPmMmJ6y/T5B96kIA==", "dev": true, "license": "MIT", "dependencies": { @@ -180,30 +173,30 @@ "@azure/core-tracing": "^1.3.0", "@azure/core-util": "^1.13.0", "@azure/logger": "^1.3.0", - "@typespec/ts-http-runtime": "^0.3.0", + "@typespec/ts-http-runtime": "^0.3.4", "tslib": "^2.6.2" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } }, "node_modules/@azure/core-tracing": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.3.1.tgz", - "integrity": "sha512-9MWKevR7Hz8kNzzPLfX4EAtGM2b8mr50HPDBvio96bURP/9C+HjdH3sBlLSNNrvRAr5/k/svoH457gB5IKpmwQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.4.0.tgz", + "integrity": "sha512-eGwxD0AtncrxeBM4tG8R55Pc3rdX1hNW2WibJAgYpCVA6E93mvvVH+LcssoVjOBrSKWS55yEIHsk0X8ctHmfOQ==", "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.6.2" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } }, "node_modules/@azure/core-util": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.13.1.tgz", - "integrity": "sha512-XPArKLzsvl0Hf0CaGyKHUyVgF7oDnhKoP85Xv6M4StF/1AhfORhZudHtOyf2s+FcbuQ9dPRAjB8J2KvRRMUK2A==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.14.0.tgz", + "integrity": "sha512-9n2pWK61veAuN0V20t9lOuoV4CFMdyAZ1ygZzvBGk/pBBJRib/PjL9PLXa/aI2CcPpyHfqVsxxqLCYl6uZlfDw==", "dev": true, "license": "MIT", "dependencies": { @@ -212,36 +205,75 @@ "tslib": "^2.6.2" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } }, "node_modules/@azure/identity": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.13.0.tgz", - "integrity": "sha512-uWC0fssc+hs1TGGVkkghiaFkkS7NkTxfnCH+Hdg+yTehTpMcehpok4PgUKKdyCH+9ldu6FhiHRv84Ntqj1vVcw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.14.0.tgz", + "integrity": "sha512-8utCLdTZn14CiAe0HW4JbtzUMsc0mdDwnjUvStFMrR4IxQP8S2eL9zVAdplpfORVJGYmidZElpeXRYjJQ4UyUw==", "dev": true, "license": "MIT", "dependencies": { "@azure/abort-controller": "^2.0.0", "@azure/core-auth": "^1.9.0", "@azure/core-client": "^1.9.2", + "@azure/core-process": "^1.0.0", "@azure/core-rest-pipeline": "^1.17.0", "@azure/core-tracing": "^1.0.0", "@azure/core-util": "^1.11.0", "@azure/logger": "^1.0.0", - "@azure/msal-browser": "^4.2.0", - "@azure/msal-node": "^3.5.0", - "open": "^10.1.0", + "@azure/msal-browser": "^5.5.0", + "@azure/msal-node": "^6.0.0", + "open": "^11.0.0", "tslib": "^2.2.0" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" + } + }, + "node_modules/@azure/identity/node_modules/open": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/open/-/open-11.0.4.tgz", + "integrity": "sha512-++Zlftm0kVLPmzC06t6epuWmcRMDbI4z5P3NNX979WA/k23+NtSOynEGzsVfZwguKw2mi5umVgnBlJQMwRz4Pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^5.5.1", + "define-lazy-prop": "^3.0.0", + "is-in-ssh": "^1.0.0", + "is-inside-container": "^1.0.0", + "powershell-utils": "^0.2.1", + "wsl-utils": "^1.0.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@azure/identity/node_modules/wsl-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-1.0.1.tgz", + "integrity": "sha512-c16PKLIRxBYpR3jSWsdS7SFp0COm5SOQdiFjY818dYFHJbMGuLBszpF07LBWmOS1uzrHa9VGdynsEgoeKy0oOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-wsl": "^3.1.0", + "powershell-utils": "^0.2.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@azure/logger": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.3.0.tgz", - "integrity": "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.4.0.tgz", + "integrity": "sha512-rbAE25KUfjU/s3XHUdJgceoCP5dEOpMx85J04kF+QMdta73XkuG9JGHHinch+XIoKpBdqljin+KqURpJriSzLA==", "dev": true, "license": "MIT", "dependencies": { @@ -249,26 +281,26 @@ "tslib": "^2.6.2" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } }, "node_modules/@azure/msal-browser": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.28.1.tgz", - "integrity": "sha512-al2u2fTchbClq3L4C1NlqLm+vwKfhYCPtZN2LR/9xJVaQ4Mnrwf5vANvuyPSJHcGvw50UBmhuVmYUAhTEetTpA==", + "version": "5.26.0", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-5.26.0.tgz", + "integrity": "sha512-GYKRquzDZmZggCdStWy2bNJKnPui1upssSuznJgP+/h6Mb0ldkUkaGvaY6uSGGmZOm0CGiBQ3b5BiGy43BpXSg==", "dev": true, "license": "MIT", "dependencies": { - "@azure/msal-common": "15.14.1" + "@azure/msal-common": "16.14.3" }, "engines": { "node": ">=0.8.0" } }, "node_modules/@azure/msal-common": { - "version": "15.14.1", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.14.1.tgz", - "integrity": "sha512-IkzF7Pywt6QKTS0kwdCv/XV8x8JXknZDvSjj/IccooxnP373T5jaadO3FnOrbWo3S0UqkfIDyZNTaQ/oAgRdXw==", + "version": "16.14.3", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.14.3.tgz", + "integrity": "sha512-tz3GvMrR9V/plb2lDdW8qaO8CPpfZevdExBKjltzzbAtyhK0eB2UIvji1aU+gkyHj3fxQ2ie+LNHyMXdmo8wOg==", "dev": true, "license": "MIT", "engines": { @@ -276,43 +308,27 @@ } }, "node_modules/@azure/msal-node": { - "version": "3.8.6", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.8.6.tgz", - "integrity": "sha512-XTmhdItcBckcVVTy65Xp+42xG4LX5GK+9AqAsXPXk4IqUNv+LyQo5TMwNjuFYBfAB2GTG9iSQGk+QLc03vhf3w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@azure/msal-common": "15.14.1", - "jsonwebtoken": "^9.0.0", - "uuid": "^8.3.0" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.28.6.tgz", - "integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-6.0.1.tgz", + "integrity": "sha512-ixSO1Y/kCVRthRs+hSx/5qkwaunX1/RAePhlMN0wIpIQ4WEZ6AREGGnGd1AP0qspHVsAwzWQKGubpjh50JyJIQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" + "@azure/msal-common": "16.14.1", + "jsonwebtoken": "^9.0.0" }, "engines": { - "node": ">=6.9.0" + "node": ">=20" } }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "node_modules/@azure/msal-node/node_modules/@azure/msal-common": { + "version": "16.14.1", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.14.1.tgz", + "integrity": "sha512-Or6xhPNyi4zHW25158yxBoyxuCqNSPa5YBVqfF1J5Ks4MJWBo/USXdp05DQIPu1Zli00YZu6t0+h6KvHJealxQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=6.9.0" + "node": ">=0.8.0" } }, "node_modules/@babel/runtime": { @@ -912,80 +928,6 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -1686,6 +1628,253 @@ "resolved": "packages/vega-morphcharts", "link": true }, + "node_modules/@napi-rs/keyring": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring/-/keyring-1.3.0.tgz", + "integrity": "sha512-WrOw/bcXm0f9qHkumlT1QlArXSTWqaY9sunsDpOk+yCCorCKMxvWT/a3xko4EYHVdeZoh00yI2TydXn6eyICDA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "optionalDependencies": { + "@napi-rs/keyring-darwin-arm64": "1.3.0", + "@napi-rs/keyring-darwin-x64": "1.3.0", + "@napi-rs/keyring-freebsd-x64": "1.3.0", + "@napi-rs/keyring-linux-arm-gnueabihf": "1.3.0", + "@napi-rs/keyring-linux-arm64-gnu": "1.3.0", + "@napi-rs/keyring-linux-arm64-musl": "1.3.0", + "@napi-rs/keyring-linux-riscv64-gnu": "1.3.0", + "@napi-rs/keyring-linux-x64-gnu": "1.3.0", + "@napi-rs/keyring-linux-x64-musl": "1.3.0", + "@napi-rs/keyring-win32-arm64-msvc": "1.3.0", + "@napi-rs/keyring-win32-ia32-msvc": "1.3.0", + "@napi-rs/keyring-win32-x64-msvc": "1.3.0" + } + }, + "node_modules/@napi-rs/keyring-darwin-arm64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-darwin-arm64/-/keyring-darwin-arm64-1.3.0.tgz", + "integrity": "sha512-pl76hJvdYUBn6I24bXiOBMA9nbDapo3I5B+f3OorjDU4dUMSypXeKbOVehJe8fhgTiH24flMyTS3aAIy43xegQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-darwin-x64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-darwin-x64/-/keyring-darwin-x64-1.3.0.tgz", + "integrity": "sha512-YcJtEV5LA3cvA4z3BurgxH5IhTsW1JfIvcAAcqcecwk06Si9F9NqkxbZVIfDwQ8oRHgaBmT3zZJnLAotCrVahw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-freebsd-x64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-freebsd-x64/-/keyring-freebsd-x64-1.3.0.tgz", + "integrity": "sha512-vlLf31TGhfRAaxLDBhg8b89ss0HHD/lyNmL5F3UjSaz5CUXElsJmKYq9fqA/B+cZKUEUcLHHGhF0I/CqcFdaVw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-arm-gnueabihf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm-gnueabihf/-/keyring-linux-arm-gnueabihf-1.3.0.tgz", + "integrity": "sha512-KiWdMMu/Inz/bHHIAGrnF7r54FZDYXuHO6UFF/rhIrshUsxbMG1Rl9lEymNtqqsVo927G0VYcb02FzWQ3iBQRQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-arm64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm64-gnu/-/keyring-linux-arm64-gnu-1.3.0.tgz", + "integrity": "sha512-eyKGpY40lm9Jvs1aD294XRH4y7+TlJM0YVAryZeXA6TX0mb4gMkxVXwSQv7MCwgah7raeUd0dKUb4BPAYIgcMg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-arm64-musl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm64-musl/-/keyring-linux-arm64-musl-1.3.0.tgz", + "integrity": "sha512-iIK6JWHXAJqDrEyLY3TmswwloVyt2vj+04TZnew+uSJ9gnDO8EwRbp3/iw3LpWaXiDO7VomGO6y8I0Id8uBZSw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-riscv64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-riscv64-gnu/-/keyring-linux-riscv64-gnu-1.3.0.tgz", + "integrity": "sha512-/PGqrwn6EwgtK6vccASSXJRfOSP4vN1F4ASsIQ+7MdrK6hNvAJ1FZPrIuD5gGGdxezo3F++To2Wq7DbuGIeuNQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-x64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-x64-gnu/-/keyring-linux-x64-gnu-1.3.0.tgz", + "integrity": "sha512-2PDK1WKWTu9lBGq9VvNEkSlQD3O7YwVpmnyN2M3cy4v7NJ/8gDMd9GXv3G+FVXN13uhp4gnnPBS+ScefmEeD2A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-linux-x64-musl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-x64-musl/-/keyring-linux-x64-musl-1.3.0.tgz", + "integrity": "sha512-oJ2HkX8YUo46QBkn0pG+HuIKQNqr523q6vBobCn+P95s4C4K6/kLBqHY/1bg5J4ap31DzsznhnFKcfBNBsjCnw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-win32-arm64-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-arm64-msvc/-/keyring-win32-arm64-msvc-1.3.0.tgz", + "integrity": "sha512-tOd3c/uAaeoE4ycVlmAdSvygz0Zt3zdca6Y7gokBeIbaRDWpjDIUOpU3MvML59XAaqyuKGsVVu0F/DZb1lHPmw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-win32-ia32-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-ia32-msvc/-/keyring-win32-ia32-msvc-1.3.0.tgz", + "integrity": "sha512-sPSqeAFZMGqP1R++M2JTza7GQJJ/TpCo6JU6Vcd4jnebvOaEDs9b7eipakU1PJdSvhpC2yXMCNRk9gXfrhuwHQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/keyring-win32-x64-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-x64-msvc/-/keyring-win32-x64-msvc-1.3.0.tgz", + "integrity": "sha512-4DnCWXwDc0HRKwyRlG5y0VhKZW2tNRQfKKfyj6IX/KWfDNyq9hn4n+GL1auyDcOO/v8PwnhmYo2+rOOqCkvvOg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@napi-rs/wasm-runtime": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.5.tgz", @@ -1718,44 +1907,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/@oxc-project/types": { "version": "0.133.0", "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.133.0.tgz", @@ -3038,117 +3189,30 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@secretlint/config-creator": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@secretlint/config-creator/-/config-creator-10.2.2.tgz", - "integrity": "sha512-BynOBe7Hn3LJjb3CqCHZjeNB09s/vgf0baBaHVw67w7gHF0d25c3ZsZ5+vv8TgwSchRdUCRrbbcq5i2B1fJ2QQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@secretlint/types": "^10.2.2" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "node_modules/@secretlint/config-loader": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@secretlint/config-loader/-/config-loader-10.2.2.tgz", - "integrity": "sha512-ndjjQNgLg4DIcMJp4iaRD6xb9ijWQZVbd9694Ol2IszBIbGPPkwZHzJYKICbTBmh6AH/pLr0CiCaWdGJU7RbpQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@secretlint/profiler": "^10.2.2", - "@secretlint/resolver": "^10.2.2", - "@secretlint/types": "^10.2.2", - "ajv": "^8.17.1", - "debug": "^4.4.1", - "rc-config-loader": "^4.1.3" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "node_modules/@secretlint/core": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@secretlint/core/-/core-10.2.2.tgz", - "integrity": "sha512-6rdwBwLP9+TO3rRjMVW1tX+lQeo5gBbxl1I5F8nh8bgGtKwdlCMhMKsBWzWg1ostxx/tIG7OjZI0/BxsP8bUgw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@secretlint/profiler": "^10.2.2", - "@secretlint/types": "^10.2.2", - "debug": "^4.4.1", - "structured-source": "^4.0.0" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "node_modules/@secretlint/formatter": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@secretlint/formatter/-/formatter-10.2.2.tgz", - "integrity": "sha512-10f/eKV+8YdGKNQmoDUD1QnYL7TzhI2kzyx95vsJKbEa8akzLAR5ZrWIZ3LbcMmBLzxlSQMMccRmi05yDQ5YDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@secretlint/resolver": "^10.2.2", - "@secretlint/types": "^10.2.2", - "@textlint/linter-formatter": "^15.2.0", - "@textlint/module-interop": "^15.2.0", - "@textlint/types": "^15.2.0", - "chalk": "^5.4.1", - "debug": "^4.4.1", - "pluralize": "^8.0.0", - "strip-ansi": "^7.1.0", - "table": "^6.9.0", - "terminal-link": "^4.0.0" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "node_modules/@secretlint/formatter/node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", + "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/@secretlint/node": { + "node_modules/@secretlint/core": { "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@secretlint/node/-/node-10.2.2.tgz", - "integrity": "sha512-eZGJQgcg/3WRBwX1bRnss7RmHHK/YlP/l7zOQsrjexYt6l+JJa5YhUmHbuGXS94yW0++3YkEJp0kQGYhiw1DMQ==", + "resolved": "https://registry.npmjs.org/@secretlint/core/-/core-10.2.2.tgz", + "integrity": "sha512-6rdwBwLP9+TO3rRjMVW1tX+lQeo5gBbxl1I5F8nh8bgGtKwdlCMhMKsBWzWg1ostxx/tIG7OjZI0/BxsP8bUgw==", "dev": true, "license": "MIT", "dependencies": { - "@secretlint/config-loader": "^10.2.2", - "@secretlint/core": "^10.2.2", - "@secretlint/formatter": "^10.2.2", "@secretlint/profiler": "^10.2.2", - "@secretlint/source-creator": "^10.2.2", "@secretlint/types": "^10.2.2", "debug": "^4.4.1", - "p-map": "^7.0.3" + "structured-source": "^4.0.0" }, "engines": { "node": ">=20.0.0" @@ -3161,23 +3225,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@secretlint/resolver": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@secretlint/resolver/-/resolver-10.2.2.tgz", - "integrity": "sha512-3md0cp12e+Ae5V+crPQYGd6aaO7ahw95s28OlULGyclyyUtf861UoRGS2prnUrKh7MZb23kdDOyGCYb9br5e4w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@secretlint/secretlint-formatter-sarif": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/@secretlint/secretlint-formatter-sarif/-/secretlint-formatter-sarif-10.2.2.tgz", - "integrity": "sha512-ojiF9TGRKJJw308DnYBucHxkpNovDNu1XvPh7IfUp0A12gzTtxuWDqdpuVezL7/IP8Ua7mp5/VkDMN9OLp1doQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "node-sarif-builder": "^3.2.0" - } - }, "node_modules/@secretlint/secretlint-rule-no-dotenv": { "version": "10.2.2", "resolved": "https://registry.npmjs.org/@secretlint/secretlint-rule-no-dotenv/-/secretlint-rule-no-dotenv-10.2.2.tgz", @@ -3225,19 +3272,6 @@ "node": ">=20.0.0" } }, - "node_modules/@sindresorhus/merge-streams": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", - "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@swc/helpers": { "version": "0.5.18", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.18.tgz", @@ -3247,90 +3281,6 @@ "tslib": "^2.8.0" } }, - "node_modules/@textlint/ast-node-types": { - "version": "15.5.1", - "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-15.5.1.tgz", - "integrity": "sha512-2ABQSaQoM9u9fycXLJKcCv4XQulJWTUSwjo6F0i/ujjqOH8/AZ2A0RDKKbAddqxDhuabVB20lYoEsZZgzehccg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@textlint/linter-formatter": { - "version": "15.5.1", - "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-15.5.1.tgz", - "integrity": "sha512-7wfzpcQtk7TZ3UJO2deTI71mJCm4VvPGUmSwE4iuH6FoaxpdWpwSBiMLcZtjYrt/oIFOtNz0uf5rI+xJiHTFww==", - "dev": true, - "license": "MIT", - "dependencies": { - "@azu/format-text": "^1.0.2", - "@azu/style-format": "^1.0.1", - "@textlint/module-interop": "15.5.1", - "@textlint/resolver": "15.5.1", - "@textlint/types": "15.5.1", - "chalk": "^4.1.2", - "debug": "^4.4.3", - "js-yaml": "^4.1.1", - "lodash": "^4.17.21", - "pluralize": "^2.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "table": "^6.9.0", - "text-table": "^0.2.0" - } - }, - "node_modules/@textlint/linter-formatter/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@textlint/linter-formatter/node_modules/pluralize": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-2.0.0.tgz", - "integrity": "sha512-TqNZzQCD4S42De9IfnnBvILN7HAW7riLqsCyp8lgjXeysyPlX5HhqKAcJHHHb9XskE4/a+7VGC9zzx8Ls0jOAw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@textlint/linter-formatter/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@textlint/module-interop": { - "version": "15.5.1", - "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-15.5.1.tgz", - "integrity": "sha512-Y1jcFGCKNSmHxwsLO3mshOfLYX4Wavq2+w5BG6x5lGgZv0XrF1xxURRhbnhns4LzCu0fAcx6W+3V8/1bkyTZCw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@textlint/resolver": { - "version": "15.5.1", - "resolved": "https://registry.npmjs.org/@textlint/resolver/-/resolver-15.5.1.tgz", - "integrity": "sha512-CVHxMIm8iNGccqM12CQ/ycvh+HjJId4RyC6as5ynCcp2E1Uy1TCe0jBWOpmLsbT4Nx15Ke29BmspyByawuIRyA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@textlint/types": { - "version": "15.5.1", - "resolved": "https://registry.npmjs.org/@textlint/types/-/types-15.5.1.tgz", - "integrity": "sha512-IY1OVZZk8LOOrbapYCsaeH7XSJT89HVukixDT8CoiWMrKGCTCZ3/Kzoa3DtMMbY8jtY777QmPOVCNnR+8fF6YQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@textlint/ast-node-types": "15.5.1" - } - }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -3569,13 +3519,6 @@ "undici-types": "~7.16.0" } }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", - "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/prop-types": { "version": "15.7.15", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", @@ -3630,13 +3573,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/sarif": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@types/sarif/-/sarif-2.1.7.tgz", - "integrity": "sha512-kRz0VEkJqWLf1LLVN4pT1cg1Z9wAuvI6L97V3m2f5B76Tg8d413ddvLBPTEHAZJlnn4XSvu0FkZtViCQGVyrXQ==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/scheduler": { "version": "0.16.8", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", @@ -3993,9 +3929,9 @@ } }, "node_modules/@typespec/ts-http-runtime": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.2.tgz", - "integrity": "sha512-IlqQ/Gv22xUC1r/WQm4StLkYQmaaTsXAhUVsNE0+xiyf0yRFiH5++q78U3bw6bLKDCTmh0uqKB9eG9+Bt75Dkg==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.9.tgz", + "integrity": "sha512-edSdeAqkdxBVzA1yL1LrLCml1YjyCVvPMtMqJpbF+6K609tHe8V6sQUzFQSGcYNhcuhOceZtjvN32+mpIth30A==", "dev": true, "license": "MIT", "dependencies": { @@ -4004,7 +3940,7 @@ "tslib": "^2.6.2" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } }, "node_modules/@uifabric/merge-styles": { @@ -4122,56 +4058,50 @@ "license": "0BSD" }, "node_modules/@vscode/vsce": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.7.1.tgz", - "integrity": "sha512-OTm2XdMt2YkpSn2Nx7z2EJtSuhRHsTPYsSK59hr3v8jRArK+2UEoju4Jumn1CmpgoBLGI6ReHLJ/czYltNUW3g==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-4.0.0.tgz", + "integrity": "sha512-NImwuLaenMmb5D5Jer9/lzi/F9ZQUBOp8Azhj/BVYcTFgixv8KehFXqEUDjQlD2tAiw2E6dDGyjTuAB//di60A==", "dev": true, "license": "MIT", "dependencies": { - "@azure/identity": "^4.1.0", - "@secretlint/node": "^10.1.2", - "@secretlint/secretlint-formatter-sarif": "^10.1.2", - "@secretlint/secretlint-rule-no-dotenv": "^10.1.2", - "@secretlint/secretlint-rule-preset-recommend": "^10.1.2", - "@vscode/vsce-sign": "^2.0.0", + "@azure/identity": "^4.13.2", + "@napi-rs/keyring": "^1.3.0", + "@secretlint/core": "^10.2.2", + "@secretlint/secretlint-rule-no-dotenv": "^10.2.2", + "@secretlint/secretlint-rule-preset-recommend": "^10.2.2", + "@secretlint/source-creator": "^10.2.2", + "@secretlint/types": "^10.2.2", + "@vscode/vsce-sign": "^2.1.0", "azure-devops-node-api": "^12.5.0", - "chalk": "^4.1.2", - "cheerio": "^1.0.0-rc.9", - "cockatiel": "^3.1.2", + "cockatiel": "^3.2.1", "commander": "^12.1.0", - "form-data": "^4.0.0", - "glob": "^11.0.0", - "hosted-git-info": "^4.0.2", - "jsonc-parser": "^3.2.0", - "leven": "^3.1.0", - "markdown-it": "^14.1.0", - "mime": "^1.3.4", - "minimatch": "^3.0.3", - "parse-semver": "^1.1.1", + "hosted-git-info": "^4.1.0", + "jsonc-parser": "^3.3.1", + "marked": "^18.0.11", + "mime": "^1.6.0", + "minimatch": "^10.2.6", + "parse5": "^8.0.1", + "proper-lockfile": "^4.1.2", "read": "^1.0.7", - "secretlint": "^10.1.2", - "semver": "^7.5.2", - "tmp": "^0.2.3", - "typed-rest-client": "^1.8.4", + "semver": "^7.8.5", + "tinyglobby": "^0.2.17", + "typed-rest-client": "^1.8.11", "url-join": "^4.0.1", "xml2js": "^0.5.0", - "yauzl": "^2.3.1", - "yazl": "^2.2.2" + "yauzl": "^3.4.0", + "yazl": "^2.5.1" }, "bin": { "vsce": "vsce" }, "engines": { - "node": ">= 20" - }, - "optionalDependencies": { - "keytar": "^7.7.0" + "node": ">= 22" } }, "node_modules/@vscode/vsce-sign": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.9.tgz", - "integrity": "sha512-8IvaRvtFyzUnGGl3f5+1Cnor3LqaUWvhaUjAYO8Y39OUYlOf3cRd+dowuQYLpZcP3uwSG+mURwjEBOSq4SOJ0g==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.1.0.tgz", + "integrity": "sha512-9AQrqazrBgTgRSuwleLVXUrIUphY02/SFCh2TKYoLV/xifJAdblhdmEmw5gUrYSPQ3sRwNs9iyCMD14sATEE6g==", "dev": true, "hasInstallScript": true, "license": "SEE LICENSE IN LICENSE.txt", @@ -4313,42 +4243,7 @@ "win32" ] }, - "node_modules/@vscode/vsce/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@vscode/vsce/node_modules/glob": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", - "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "foreground-child": "^3.3.1", - "jackspeak": "^4.1.1", - "minimatch": "^10.1.1", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@vscode/vsce/node_modules/glob/node_modules/balanced-match": { + "node_modules/@vscode/vsce/node_modules/balanced-match": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", @@ -4358,46 +4253,46 @@ "node": "18 || 20 || >=22" } }, - "node_modules/@vscode/vsce/node_modules/glob/node_modules/brace-expansion": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", - "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "node_modules/@vscode/vsce/node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" }, "engines": { - "node": "18 || 20 || >=22" + "node": "20 || >=22" } }, - "node_modules/@vscode/vsce/node_modules/glob/node_modules/minimatch": { - "version": "10.2.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", - "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "node_modules/@vscode/vsce/node_modules/marked": { + "version": "18.1.1", + "resolved": "https://registry.npmjs.org/marked/-/marked-18.1.1.tgz", + "integrity": "sha512-zEGgrtUG8crk+TrMacJSVABU4DYDDkS8uqgU3ohrn/2fW9C2AEfUrO3m6IhpIpQpl7YcVpiXXC9cSMWDANT3dg==", "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.2" + "license": "MIT", + "bin": { + "marked": "bin/marked.js" }, "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">= 20" } }, "node_modules/@vscode/vsce/node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^5.0.8" }, "engines": { - "node": "*" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/@webassemblyjs/ast": { @@ -4779,22 +4674,6 @@ "node": ">=6" } }, - "node_modules/ansi-escapes": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.2.0.tgz", - "integrity": "sha512-g6LhBsl+GBPRWGWsBtutpzBYuIIdBkLEvad5C/va/74Db018+5TZiyA26cZJAr3Rft5lprVqOIPxf5Vid6tqAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "environment": "^1.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ansi-html-community": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz", @@ -4808,19 +4687,6 @@ "ansi-html": "bin/ansi-html" } }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -5064,16 +4930,6 @@ "util": "^0.12.5" } }, - "node_modules/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, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", @@ -5091,13 +4947,6 @@ "node": ">= 0.4" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true, - "license": "MIT" - }, "node_modules/at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", @@ -5248,19 +5097,6 @@ "url": "https://bevry.me/fund" } }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "node_modules/bluebird": { "version": "3.4.7", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", @@ -5341,13 +5177,6 @@ "multicast-dns": "^7.2.5" } }, - "node_modules/boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true, - "license": "ISC" - }, "node_modules/boundary": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/boundary/-/boundary-2.0.0.tgz", @@ -5666,32 +5495,6 @@ "node": ">=4" } }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "optional": true, - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", @@ -5894,63 +5697,19 @@ }, "node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/cheerio": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.1.2.tgz", - "integrity": "sha512-IkxPpb5rS/d1IiLbHMgfPuS0FgiWTtFIm/Nj+2woXDLTZ7fOT2eqzgYbdMlLweqlHbsZjxEChoVK+7iph7jyQg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cheerio-select": "^2.1.0", - "dom-serializer": "^2.0.0", - "domhandler": "^5.0.3", - "domutils": "^3.2.2", - "encoding-sniffer": "^0.2.1", - "htmlparser2": "^10.0.0", - "parse5": "^7.3.0", - "parse5-htmlparser2-tree-adapter": "^7.1.0", - "parse5-parser-stream": "^7.1.2", - "undici": "^7.12.0", - "whatwg-mimetype": "^4.0.0" - }, - "engines": { - "node": ">=20.18.1" - }, - "funding": { - "url": "https://github.com/cheeriojs/cheerio?sponsor=1" - } - }, - "node_modules/cheerio-select": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", - "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "boolbase": "^1.0.0", - "css-select": "^5.1.0", - "css-what": "^6.1.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/fb55" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/chokidar": { @@ -5991,14 +5750,6 @@ "node": ">= 6" } }, - "node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "dev": true, - "license": "ISC", - "optional": true - }, "node_modules/chrome-trace-event": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", @@ -6124,19 +5875,6 @@ "dev": true, "license": "MIT" }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", @@ -6441,36 +6179,6 @@ } } }, - "node_modules/css-select": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", - "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-what": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", - "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -6842,34 +6550,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -6887,9 +6567,9 @@ } }, "node_modules/default-browser": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.4.0.tgz", - "integrity": "sha512-XDuvSq38Hr1MdN47EDvYtx3U0MTqpCEn+F6ft8z2vYDzMrvQhVp0ui9oQdqW3MvK3vqUETglt1tVGgjLuJ5izg==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.1.tgz", + "integrity": "sha512-m1pAzaJgZ/gssEqlOhJkPJp8Xly7QyW6xcrkUa2KKcDeDSEMP7X8xipU3snUcfisTQx0w1AGae+9UtJSfVnXGw==", "dev": true, "license": "MIT", "dependencies": { @@ -6974,16 +6654,6 @@ "robust-predicates": "^3.0.2" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -7088,21 +6758,6 @@ "node": ">=0.10.0" } }, - "node_modules/dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", - "dev": true, - "license": "MIT", - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, "node_modules/domain-browser": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-5.7.0.tgz", @@ -7116,50 +6771,6 @@ "url": "https://bevry.me/fund" } }, - "node_modules/domelementtype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "BSD-2-Clause" - }, - "node_modules/domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.3.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/domutils": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", - "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -7239,13 +6850,6 @@ "dev": true, "license": "ISC" }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -7327,31 +6931,6 @@ "node": ">= 0.8" } }, - "node_modules/encoding-sniffer": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", - "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", - "dev": true, - "license": "MIT", - "dependencies": { - "iconv-lite": "^0.6.3", - "whatwg-encoding": "^3.1.1" - }, - "funding": { - "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" - } - }, - "node_modules/end-of-stream": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", - "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/enhanced-resolve": { "version": "5.18.4", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.4.tgz", @@ -7367,13 +6946,13 @@ } }, "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", "dev": true, "license": "BSD-2-Clause", "engines": { - "node": ">=0.12" + "node": ">=20.19.0" }, "funding": { "url": "https://github.com/fb55/entities?sponsor=1" @@ -7392,19 +6971,6 @@ "node": ">=4" } }, - "node_modules/environment": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", - "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/errno": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", @@ -7412,7 +6978,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "dependencies": { "prr": "~1.0.1" }, @@ -8070,17 +7635,6 @@ "safe-buffer": "^5.1.1" } }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "dev": true, - "license": "(MIT OR WTFPL)", - "optional": true, - "engines": { - "node": ">=6" - } - }, "node_modules/express": { "version": "4.22.2", "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz", @@ -8266,36 +7820,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/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, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/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", @@ -8337,16 +7861,6 @@ "node": ">= 4.9.1" } }, - "node_modules/fastq": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", - "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" - } - }, "node_modules/faye-websocket": { "version": "0.11.4", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", @@ -8360,16 +7874,6 @@ "node": ">=0.8.0" } }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" - } - }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -8535,40 +8039,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/foreground-child": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", - "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.6", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/form-data": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", - "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "es-set-tostringtag": "^2.1.0", - "hasown": "^2.0.4", - "mime-types": "^2.1.35" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -8589,14 +8059,6 @@ "node": ">= 0.6" } }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true, - "license": "MIT", - "optional": true - }, "node_modules/fs-extra": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", @@ -8827,14 +8289,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", - "dev": true, - "license": "MIT", - "optional": true - }, "node_modules/github-slugger": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz", @@ -8972,40 +8426,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/globby": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.1.0.tgz", - "integrity": "sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@sindresorhus/merge-streams": "^2.1.0", - "fast-glob": "^3.3.3", - "ignore": "^7.0.3", - "path-type": "^6.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.3.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby/node_modules/path-type": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-6.0.0.tgz", - "integrity": "sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -9259,52 +8679,19 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true, - "license": "MIT" - }, - "node_modules/htmlparser2": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz", - "integrity": "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==", - "dev": true, - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "MIT", - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.2.2", - "entities": "^7.0.1" - } - }, - "node_modules/htmlparser2/node_modules/entities": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", - "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" } }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, "node_modules/http-deceiver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", @@ -9501,7 +8888,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "bin": { "image-size": "bin/image-size.js" }, @@ -9583,19 +8969,6 @@ "indefinitely-typed": "bin/cli2.js" } }, - "node_modules/index-to-position": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", - "integrity": "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -9615,14 +8988,6 @@ "dev": true, "license": "ISC" }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true, - "license": "ISC", - "optional": true - }, "node_modules/inline-source-map": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.3.tgz", @@ -9978,6 +9343,19 @@ "node": ">=0.10.0" } }, + "node_modules/is-in-ssh": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-in-ssh/-/is-in-ssh-1.0.0.tgz", + "integrity": "sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -10367,22 +9745,6 @@ "node": ">= 0.4" } }, - "node_modules/jackspeak": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", - "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/jest-worker": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", @@ -10494,19 +9856,6 @@ "dev": true, "license": "MIT" }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/jsonc-parser": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", @@ -10644,19 +9993,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/keytar": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", - "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "dependencies": { - "node-addon-api": "^4.3.0", - "prebuild-install": "^7.0.1" - } - }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -10750,7 +10086,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "dependencies": { "pify": "^4.0.1", "semver": "^5.6.0" @@ -10766,7 +10101,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "engines": { "node": ">=6" } @@ -10778,7 +10112,6 @@ "dev": true, "license": "ISC", "optional": true, - "peer": true, "bin": { "semver": "bin/semver" } @@ -10790,21 +10123,10 @@ "dev": true, "license": "BSD-3-Clause", "optional": true, - "peer": true, "engines": { "node": ">=0.10.0" } }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -11090,26 +10412,6 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/linkify-it": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz", - "integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/puzrin" - }, - { - "type": "github", - "url": "https://github.com/sponsors/markdown-it" - } - ], - "license": "MIT", - "dependencies": { - "uc.micro": "^2.0.0" - } - }, "node_modules/listenercount": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", @@ -11163,13 +10465,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", - "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", - "dev": true, - "license": "MIT" - }, "node_modules/lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", @@ -11255,13 +10550,6 @@ "dev": true, "license": "MIT" }, - "node_modules/lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true, - "license": "MIT" - }, "node_modules/lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -11334,34 +10622,6 @@ "node": ">=4" } }, - "node_modules/markdown-it": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.2.0.tgz", - "integrity": "sha512-1TGiQiJVRQ3NPmZH6sx5Cfnmg6GQm9jvC1ch4TK511NjSJvjzKLzn5pPfZRNZkRPZP0HqCioSndqH8v2nRaWVQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/puzrin" - }, - { - "type": "github", - "url": "https://github.com/sponsors/markdown-it" - } - ], - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1", - "entities": "^4.4.0", - "linkify-it": "^5.0.1", - "mdurl": "^2.0.0", - "punycode.js": "^2.3.1", - "uc.micro": "^2.1.0" - }, - "bin": { - "markdown-it": "bin/markdown-it.mjs" - } - }, "node_modules/marked": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", @@ -11431,13 +10691,6 @@ "unist-util-visit": "^1.1.0" } }, - "node_modules/mdurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", - "dev": true, - "license": "MIT" - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -11504,16 +10757,6 @@ "dev": true, "license": "MIT" }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -11608,20 +10851,6 @@ "node": ">= 0.6" } }, - "node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/mini-css-extract-plugin": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.10.0.tgz", @@ -11720,14 +10949,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true, - "license": "MIT", - "optional": true - }, "node_modules/mocha": { "version": "10.8.2", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", @@ -11881,14 +11102,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/napi-build-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", - "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", - "dev": true, - "license": "MIT", - "optional": true - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -11903,7 +11116,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "dependencies": { "iconv-lite": "^0.6.3", "sax": "^1.2.4" @@ -11939,28 +11151,6 @@ "dev": true, "license": "MIT" }, - "node_modules/node-abi": { - "version": "3.87.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.87.0.tgz", - "integrity": "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-addon-api": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", - "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", - "dev": true, - "license": "MIT", - "optional": true - }, "node_modules/node-releases": { "version": "2.0.27", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", @@ -11968,58 +11158,6 @@ "dev": true, "license": "MIT" }, - "node_modules/node-sarif-builder": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/node-sarif-builder/-/node-sarif-builder-3.4.0.tgz", - "integrity": "sha512-tGnJW6OKRii9u/b2WiUViTJS+h7Apxx17qsMUjsUeNDiMMX5ZFf8F8Fcz7PAQ6omvOxHZtvDTmOYKJQwmfpjeg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/sarif": "^2.1.7", - "fs-extra": "^11.1.1" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/node-sarif-builder/node_modules/fs-extra": { - "version": "11.3.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", - "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/node-sarif-builder/node_modules/jsonfile": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", - "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/node-sarif-builder/node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -12261,19 +11399,6 @@ "which": "bin/which" } }, - "node_modules/nth-check": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0" - }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -12542,19 +11667,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-map": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz", - "integrity": "sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/p-retry": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-6.2.1.tgz", @@ -12651,79 +11763,19 @@ "node": ">= 0.10" } }, - "node_modules/parse-semver": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", - "integrity": "sha512-Eg1OuNntBMH0ojvEKSrvDSnwLmvVuUOSdylH/pSCPNMIspLlweJyIWXCE+k/5hm3cj/EBUYwmWkjhBALNP4LXQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^5.1.0" - } - }, - "node_modules/parse-semver/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, "node_modules/parse5": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", - "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", - "dev": true, - "license": "MIT", - "dependencies": { - "entities": "^6.0.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/parse5-htmlparser2-tree-adapter": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", - "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "domhandler": "^5.0.3", - "parse5": "^7.0.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/parse5-parser-stream": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", - "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", "dev": true, "license": "MIT", "dependencies": { - "parse5": "^7.0.0" + "entities": "^8.0.0" }, "funding": { "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/parse5/node_modules/entities": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", - "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -13008,16 +12060,6 @@ "node": ">=16.0.0" } }, - "node_modules/pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/possible-typed-array-names": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", @@ -13427,32 +12469,17 @@ "node": ">= 10.0.0" } }, - "node_modules/prebuild-install": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", - "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "node_modules/powershell-utils": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.2.1.tgz", + "integrity": "sha512-C+y9x90UElAddDZmV4qOx9W53B61PO7cIqWz2dQsWlwswuq4mr8NEwytdGKboYbQlGZ3awrkTeNvcZiZNHnQ8A==", "dev": true, "license": "MIT", - "optional": true, - "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^2.0.0", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, "engines": { - "node": ">=10" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/prelude-ls": { @@ -13507,6 +12534,28 @@ "react-is": "^16.13.1" } }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/proper-lockfile/node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -13537,8 +12586,7 @@ "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", "dev": true, "license": "MIT", - "optional": true, - "peer": true + "optional": true }, "node_modules/public-encrypt": { "version": "4.0.3", @@ -13562,18 +12610,6 @@ "dev": true, "license": "MIT" }, - "node_modules/pump": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", - "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -13584,16 +12620,6 @@ "node": ">=6" } }, - "node_modules/punycode.js": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", - "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/pvtsutils": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.6.tgz", @@ -13639,27 +12665,6 @@ "node": ">=0.4.x" } }, - "node_modules/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, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -13720,47 +12725,6 @@ "node": ">=0.10.0" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", - "optional": true, - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc-config-loader": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-4.1.3.tgz", - "integrity": "sha512-kD7FqML7l800i6pS6pvLyIE2ncbk9Du8Q0gp/4hMPhJU6ZxApkoLcGD8ZeqgiAlfwZ6BlETq6qqe+12DUL207w==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.3.4", - "js-yaml": "^4.1.0", - "json5": "^2.2.2", - "require-from-string": "^2.0.2" - } - }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/react": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", @@ -14093,17 +13057,6 @@ "node": ">= 4" } }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, "node_modules/rimraf": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.2.tgz", @@ -14299,30 +13252,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/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, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, "node_modules/rw": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", @@ -14517,114 +13446,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/secretlint": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/secretlint/-/secretlint-10.2.2.tgz", - "integrity": "sha512-xVpkeHV/aoWe4vP4TansF622nBEImzCY73y/0042DuJ29iKIaqgoJ8fGxre3rVSHHbxar4FdJobmTnLp9AU0eg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@secretlint/config-creator": "^10.2.2", - "@secretlint/formatter": "^10.2.2", - "@secretlint/node": "^10.2.2", - "@secretlint/profiler": "^10.2.2", - "debug": "^4.4.1", - "globby": "^14.1.0", - "read-pkg": "^9.0.1" - }, - "bin": { - "secretlint": "bin/secretlint.js" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "node_modules/secretlint/node_modules/hosted-git-info": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", - "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^10.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/secretlint/node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/secretlint/node_modules/normalize-package-data": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", - "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^7.0.0", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/secretlint/node_modules/parse-json": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", - "integrity": "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.26.2", - "index-to-position": "^1.1.0", - "type-fest": "^4.39.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/secretlint/node_modules/read-pkg": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", - "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/normalize-package-data": "^2.4.3", - "normalize-package-data": "^6.0.0", - "parse-json": "^8.0.0", - "type-fest": "^4.6.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/secretlint/node_modules/unicorn-magic": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", - "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -14647,9 +13468,9 @@ } }, "node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -15013,111 +13834,25 @@ } }, "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "optional": true - }, - "node_modules/simple-get": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "optional": true, - "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "node_modules/sirv": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", - "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@polka/url": "^1.0.0-next.24", - "mrmime": "^2.0.0", - "totalist": "^3.0.0" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "ISC" }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "node_modules/sirv": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", + "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", "dev": true, "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" + "node": ">= 10" } }, "node_modules/sockjs": { @@ -15322,45 +14057,6 @@ "node": ">=8" } }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/string-width/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -15501,46 +14197,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -15587,23 +14243,6 @@ "node": ">=8" } }, - "node_modules/supports-hyperlinks": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz", - "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=14.18" - }, - "funding": { - "url": "https://github.com/chalk/supports-hyperlinks?sponsor=1" - } - }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -15617,46 +14256,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/table": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz", - "integrity": "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/table/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/table/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/tapable": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", @@ -15671,38 +14270,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/tar-fs": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", - "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/temp-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", @@ -15742,23 +14309,6 @@ "uuid": "bin/uuid" } }, - "node_modules/terminal-link": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-4.0.0.tgz", - "integrity": "sha512-lk+vH+MccxNqgVqSnkMVKx4VLJfnLjDBGzH16JVZjKE2DoxP57s6/vt6JmXV5I3jBcfGrxNrYtC+mPtU7WJztA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-escapes": "^7.0.0", - "supports-hyperlinks": "^3.2.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/terser": { "version": "5.46.0", "resolved": "https://registry.npmjs.org/terser/-/terser-5.46.0.tgz", @@ -15833,13 +14383,6 @@ "dev": true, "license": "MIT" }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT" - }, "node_modules/textextensions": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-6.11.0.tgz", @@ -15910,16 +14453,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tmp": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz", - "integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.14" - } - }, "node_modules/to-buffer": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz", @@ -16112,20 +14645,6 @@ "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -16139,19 +14658,6 @@ "node": ">= 0.8.0" } }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -16270,13 +14776,6 @@ "node": ">=14.17" } }, - "node_modules/uc.micro": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", - "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", - "dev": true, - "license": "MIT" - }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", @@ -16303,16 +14802,6 @@ "dev": true, "license": "MIT" }, - "node_modules/undici": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", - "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=20.18.1" - } - }, "node_modules/undici-types": { "version": "7.16.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", @@ -16364,19 +14853,6 @@ "node": ">=4" } }, - "node_modules/unicorn-magic": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", - "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/unified": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/unified/-/unified-7.1.0.tgz", @@ -17696,30 +16172,6 @@ "node": ">=0.8.0" } }, - "node_modules/whatwg-encoding": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", - "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", - "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", - "dev": true, - "license": "MIT", - "dependencies": { - "iconv-lite": "0.6.3" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/whatwg-mimetype": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", - "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -17867,48 +16319,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/wrap-ansi/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -18090,14 +16500,16 @@ } }, "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.4.0.tgz", + "integrity": "sha512-jIH9yLR9wqr0wOS0TpBvo/g/2UgZH5qePVbjgRliiF0BYvOZyaBknKsF+x9Iht0O6sqgnB93rCICdOZFecJuDw==", "dev": true, "license": "MIT", "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" + "pend": "~1.2.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/yazl": { diff --git a/package.json b/package.json index 1f755be05..2c4bc1799 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "@typescript-eslint/eslint-plugin": "^8.33.1", "@typescript-eslint/parser": "^8.33.1", "@uifabric/styling": "^7.25.1", - "@vscode/vsce": "^3.6.0", + "@vscode/vsce": "^4.0.0", "core-js": "3.2.1", "d3-color": "^3.1.0", "d3-ease": "^1.0.5", @@ -114,5 +114,8 @@ "packages/powerbi/**", "packages/powerbi/**/**" ] + }, + "allowScripts": { + "@vscode/vsce-sign@2.1.0": true } } From 4e6d5f9232e6f8f561f49db897855e092453ffad Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 15:33:16 -0700 Subject: [PATCH 08/13] Add ensure-api script to manage local Power BI dependencies --- dev.md | 5 +++++ packages/powerbi/package.json | 5 ++++- packages/powerbi/scripts/ensure-api.js | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 packages/powerbi/scripts/ensure-api.js diff --git a/dev.md b/dev.md index c3e2cd34b..f016ec959 100644 --- a/dev.md +++ b/dev.md @@ -28,6 +28,11 @@ sufficient. If install scripts were skipped, run `cd packages/powerbi` followed by `npm install --prefix=. --workspaces=false` before building. +Installing or updating a named dependency at the repository root can prune these +local dependencies without running the root install hook. The Power BI +`build:08`, `start`, and `pbiviz` scripts check for the local API first and restore +the visual's dependencies if it is missing. This recovery requires registry access. + Use the npm version bundled with your Node.js installation. With Node.js 24, npm 8.15 can fail during this standalone install with `Cannot set properties of null (setting 'dev')`; npm 11 completes it successfully. diff --git a/packages/powerbi/package.json b/packages/powerbi/package.json index 42b07b708..1da2c122e 100644 --- a/packages/powerbi/package.json +++ b/packages/powerbi/package.json @@ -4,11 +4,14 @@ "scripts": { "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "lint": "npm run eslint", + "ensure-api": "node ./scripts/ensure-api.js", + "prepbiviz": "npm run ensure-api", "pbiviz": "pbiviz", + "prestart": "npm run ensure-api", "start": "pbiviz start", "build:08": "pbiviz package", "version": "node ./scripts/version.js", - "prebuild:08": "npm run version", + "prebuild:08": "npm run ensure-api && npm run version", "deploy": "node ./scripts/deploy.js", "build:07": "tsc -p .", "remove-vega": "npm un vega" diff --git a/packages/powerbi/scripts/ensure-api.js b/packages/powerbi/scripts/ensure-api.js new file mode 100644 index 000000000..31330dc11 --- /dev/null +++ b/packages/powerbi/scripts/ensure-api.js @@ -0,0 +1,22 @@ +const fs = require('fs'); +const path = require('path'); +const { execFileSync } = require('child_process'); + +const visualDirectory = path.resolve(__dirname, '..'); +const apiPath = path.join(visualDirectory, 'node_modules', 'powerbi-visuals-api', 'index.js'); + +if (!fs.existsSync(apiPath)) { + if (!process.env.npm_execpath) { + throw new Error('Run this script through npm run ensure-api.'); + } + console.log('Restoring local Power BI dependencies required by pbiviz...'); + execFileSync(process.execPath, [ + process.env.npm_execpath, + 'install', + '--prefix=.', + '--workspaces=false', + ], { cwd: visualDirectory, stdio: 'inherit' }); + if (!fs.existsSync(apiPath)) { + throw new Error('Power BI dependency installation did not create the local powerbi-visuals-api package.'); + } +} From c1543ff59a4c1479b58fd05e0e75a4b6d263df35 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 15:57:13 -0700 Subject: [PATCH 09/13] Add license information for powerbi-visuals-api dependency --- package-lock.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package-lock.json b/package-lock.json index a48c3e99c..4cc3e14a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12197,6 +12197,7 @@ "version": "5.11.1", "resolved": "https://registry.npmjs.org/powerbi-visuals-api/-/powerbi-visuals-api-5.11.1.tgz", "integrity": "sha512-sAdzhUPEXylS3ad+RSoU+RmkT6KguoEo0DJ0SsSt0TOSpQH2vI3nPmXusb2RWH3XpsB7UufYV+d4Cgp0OMAKFw==", + "license": "MIT", "dependencies": { "semver": "^7.6.0" } From f8158da171cea44f2202473a75a97f0ce0c01df3 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 16:47:48 -0700 Subject: [PATCH 10/13] Update Dockerfile and README for improved Jekyll setup and usage instructions --- docker-jekyll-local/Dockerfile | 4 +++- docker-jekyll-local/README.md | 30 +++++++++++++++++++++++++++--- docs/Gemfile.lock | 4 ++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/docker-jekyll-local/Dockerfile b/docker-jekyll-local/Dockerfile index b877f6d8c..e3e3bcd45 100644 --- a/docker-jekyll-local/Dockerfile +++ b/docker-jekyll-local/Dockerfile @@ -2,8 +2,10 @@ FROM jekyll/jekyll:4.2.2 WORKDIR /srv/jekyll +ENV BUNDLE_FROZEN=true + # Copy the docs directory -COPY docs/ ./ +COPY --chown=jekyll:jekyll docs/ ./ # Install dependencies RUN bundle install diff --git a/docker-jekyll-local/README.md b/docker-jekyll-local/README.md index 5fa9f7d39..2b8216827 100644 --- a/docker-jekyll-local/README.md +++ b/docker-jekyll-local/README.md @@ -2,26 +2,50 @@ This repository includes Docker setup for running Jekyll locally to preview the GitHub Pages site. +On Windows, start Docker Desktop with Linux containers enabled. These commands +use Docker Compose v2 or later (`docker compose`). + ## Quick Start ### Start Jekyll ```bash cd docker-jekyll-local -docker-compose up +docker compose up --build ``` ### View your site Open http://localhost:4000/SandDance/ in your browser ### Stop Jekyll -Type ctrl-C in the terminal running `docker-compose up` +Type ctrl-C in the terminal running `docker compose up` ## Other useful commands ### Rebuild after changes ```bash cd docker-jekyll-local -docker-compose build +docker compose build +``` + +Site files are bind-mounted from `docs`, so ordinary content edits do not require +an image rebuild. Rebuild after changing the Dockerfile, Gemfile, or lockfile. + +### Troubleshooting + +If the image build reports that Bundler cannot write `/srv/jekyll/Gemfile.lock`, +ensure the Dockerfile copies the docs with `--chown=jekyll:jekyll`. The image runs +Bundler as the `jekyll` user, so root-owned copied files are not writable. +Changing Windows file permissions is not necessary. + +The base image uses Ruby 3.1. Keep the lockfile compatible with that runtime. +The image uses frozen Bundler installs so an incompatible lockfile fails during +the build instead of silently resolving different versions that disappear when +the host docs directory is mounted. To regenerate the lockfile using an existing +image, run this from `docker-jekyll-local`, then rebuild: + +```bash +docker compose run --rm -e BUNDLE_FROZEN=false jekyll bundle install +docker compose up --build ``` ## Files diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 72f680e64..148daead2 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -25,7 +25,7 @@ GEM colorator (1.1.0) commonmarker (0.23.11) concurrent-ruby (1.3.7) - connection_pool (3.0.2) + connection_pool (2.5.5) csv (3.3.5) dnsruby (1.73.1) base64 (>= 0.2) @@ -234,7 +234,7 @@ GEM minitest (5.27.0) net-http (0.9.1) uri (>= 0.11.1) - nokogiri (1.19.4-x86_64-linux-musl) + nokogiri (1.18.10-x86_64-linux-musl) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) From d84878f07a7cf30d910370354a1dc3f6040ba85b Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 16:48:03 -0700 Subject: [PATCH 11/13] version bump --- docs/examples/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/index.md b/docs/examples/index.md index 7ebc2bdb1..e85c4c206 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -30,9 +30,9 @@ title: Examples ## SandDance apps v4 * [Web app](../tests/v4/es6/app) -* [Power BI custom visual](../dist/powerbi/v4/SandDance201929976D117A654D0BAB8E96507442D80B.4.2.0.2.pbiviz) 4.2.0.2 +* [Power BI custom visual](../dist/powerbi/v4/SandDance201929976D117A654D0BAB8E96507442D80B.4.2.0.3.pbiviz) 4.2.0.3 * [Azure Data Studio extension](../dist/azdata/v4/azdata-sanddance-4.1.1.vsix) 4.1.1 -* [VSCode extension](../dist/vscode/v4/vscode-sanddance-4.2.0.vsix) 4.2.0 +* [VSCode extension](../dist/vscode/v4/vscode-sanddance-4.2.1.vsix) 4.2.1 * [sanddance-embed example](../embed/v4/test.html) ## Previous versions From ec98487c52a7af97d87aa18f721dbb49785ba091 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 16:48:35 -0700 Subject: [PATCH 12/13] Fix escape for process.env in Vite configuration --- packages/sanddance-app/vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sanddance-app/vite.config.js b/packages/sanddance-app/vite.config.js index a3126ff5c..6a2227fed 100644 --- a/packages/sanddance-app/vite.config.js +++ b/packages/sanddance-app/vite.config.js @@ -3,7 +3,7 @@ import { resolve } from 'path'; export default defineConfig({ define: { - 'process.env': process.env, + 'process.env.NODE_ENV': JSON.stringify('production'), }, build: { lib: { From 230b02d86ef96a2887eac171b5688985e6cd1038 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 23 Oct 2026 17:08:39 -0700 Subject: [PATCH 13/13] regen --- docs/app/js/sanddance-app.js | 181042 ++++++++------- ...D117A654D0BAB8E96507442D80B.4.2.0.3.pbiviz | Bin 0 -> 722599 bytes .../v4/sanddance-explorer.js | 95002 ++++---- docs/dist/sanddance/v4/sanddance.js | 21 +- .../vscode/v4/vscode-sanddance-4.2.1.vsix | Bin 0 -> 899534 bytes docs/tests/v4/es6/js/sanddance-app.js | 181042 ++++++++------- docs/tests/v4/es6/js/sanddance-test-es6.js | 121213 +++++----- .../v4/es6/js/vega-morphcharts-test-es6.js | 107947 ++++----- 8 files changed, 343709 insertions(+), 342558 deletions(-) create mode 100644 docs/dist/powerbi/v4/SandDance201929976D117A654D0BAB8E96507442D80B.4.2.0.3.pbiviz create mode 100644 docs/dist/vscode/v4/vscode-sanddance-4.2.1.vsix diff --git a/docs/app/js/sanddance-app.js b/docs/app/js/sanddance-app.js index cdba06e5a..a72858df8 100644 --- a/docs/app/js/sanddance-app.js +++ b/docs/app/js/sanddance-app.js @@ -1,8176 +1,10171 @@ -(function(global2, factory) { - typeof exports === "object" && typeof module !== "undefined" ? factory(require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.React, global2.ReactDOM)); -})(this, (function(React, ReactDOM) { - "use strict"; - function _interopNamespaceDefault(e) { - const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } }); - if (e) { - for (const k in e) { - if (k !== "default") { - const d2 = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d2.get ? d2 : { - enumerable: true, - get: () => e[k] - }); - } - } - } - n.default = e; - return Object.freeze(n); - } - const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React); - const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM); - const FieldNames = { - Active: "__SandDance__Active", - Collapsed: "__SandDance__Collapsed", - Contains: "__SandDance__Contains", - Count: "__SandDance__Count", - Sum: "__SandDance__Sum", - SumOfCount: "__SandDance__CountSum", - SumOfSum: "__SandDance__SumSum", - Selected: "__SandDance__Selected", - First: "__SandDance__First", - Last: "__SandDance__Last", - Top: "__SandDance__Top", - TopColor: "__SandDance__TopColor", - TopIndex: "__SandDance__TopIndex", - PowerBISelectionId: "__SandDance__PowerBISelectionId", - FacetSearch: "__SandDance__FacetSearch", - FacetTitle: "__SandDance__FacetTitle", - Ordinal: "__SandDance__Ordinal", - WrapCol: "__SandDance__WrapCol", - WrapRow: "__SandDance__WrapRow", - Value: "__SandDance__Value", - OffsetX: "__SandDance__X", - OffsetY: "__SandDance__Y", - OffsetHeight: "__SandDance__H", - OffsetWidth: "__SandDance__W" - }; - const ScaleNames = { - Color: "scale_color", - X: "scale_x", - Y: "scale_y", - Z: "scale_z" - }; - const SignalNames = { - ViewportWidth: "ViewportWidth", - ViewportHeight: "ViewportHeight", - MinCellWidth: "MinCellWidth", - MinCellHeight: "MinCellHeight", - PlotOffsetLeft: "PlotOffsetLeft", - PlotOffsetTop: "PlotOffsetTop", - PlotOffsetBottom: "PlotOffsetBottom", - PlotOffsetRight: "PlotOffsetRight", - PlotHeightIn: "PlotHeightIn", - PlotWidthIn: "PlotWidthIn", - PlotHeightOut: "PlotHeightOut", - PlotWidthOut: "PlotWidthOut", - ColorBinCount: "RoleColor_BinCountSignal", - ColorReverse: "RoleColor_ReverseSignal", - FacetAxesAdjustX: "RoleFacet_AxesAdjustSignalX", - FacetAxesAdjustY: "RoleFacet_AxesAdjustSignalY", - FacetBins: "RoleFacet_BinsSignal", - FacetVBins: "RoleFacetV_BinsSignal", - FacetPaddingTop: "FacetPaddingTop", - FacetPaddingBottom: "FacetPaddingBottom", - FacetPaddingLeft: "FacetPaddingLeft", - MarkOpacity: "Mark_OpacitySignal", - PointScale: "Chart_PointScaleSignal", - TextAngleX: "Text_AngleXSignal", - TextAngleY: "Text_AngleYSignal", - TextScale: "Text_ScaleSignal", - TextSize: "Text_SizeSignal", - TextTitleSize: "Text_TitleSizeSignal", - TreeMapMethod: "Chart_TreeMapMethodSignal", - XBins: "RoleX_BinsSignal", - YBins: "RoleY_BinsSignal", - ZHeight: "RoleZ_HeightSignal", - ZGrounded: "RoleZ_Grounded", - ZProportion: "RoleZ_ProportionSignal" - }; - const Other = "__Other"; - const ColorScaleNone = "none"; - const defaultBins = 10; - const maxbins = 100; - const minBarBandWidth = 15; - const minFacetWidth = 140; - const minFacetHeight = 180; - const facetPaddingLeft = 40; - const facetPaddingTop = 40; - const facetPaddingBottom = 40; - const facetPaddingRight = 40; - const axesLabelLimit = 100; - const axesTitleLimit = 100; - const axesTitlePaddingX = 30; - const axesTitlePaddingY = 60; - const axesTitlePaddingFacetX = 69; - const axesTitlePaddingFacetY = 92; - const axesOffsetX = 120; - const axesOffsetY = 120; - const scatterSizedDiv = 20; - const debounce$1 = 250; - function allowNoneForSize(specContext) { - switch (specContext.insight.totalStyle) { - case "sum-strip": - case "sum-strip-percent": - case "sum-treemap": - return false; - default: - return true; - } - } - function barchartH(specContext) { - var _a2, _b2, _c2, _d2; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: "horizontal", - groupby: { - column: specColumns.y, - defaultBins, - maxbinsSignalName: SignalNames.YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins - }, - minBandWidth: minBarBandWidth, - showAxes - }; - const x2 = { title: null }; - const axisScales = { - x: x2, - y: { title: (_a2 = specColumns.y) === null || _a2 === void 0 ? void 0 : _a2.name }, - z: { title: (_b2 = specColumns.z) === null || _b2 === void 0 ? void 0 : _b2.name } - }; - const layouts = [{ - layoutType: "Band", - props: bandProps - }]; - const { totalStyle, view } = insight; - if (totalStyle === "sum-strip-percent") { - x2.aggregate = "percent"; - x2.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: "ascending", - orientation: "horizontal", - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: "left", - globalAggregateMaxExtentSignal: "aggMaxExtent", - globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: "AggregateContainer", - props: aggProps - }); - switch (totalStyle) { - case "sum-treemap": { - x2.aggregate = "sum"; - x2.title = language.sum; - const treemapProps = { - corner: "top-left", - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Treemap", - props: treemapProps - }); - break; - } - case "sum-strip": { - x2.aggregate = "sum"; - x2.title = language.sum; - const stripProps = { - sortOrder: "ascending", - orientation: "horizontal", - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - break; - } - case "count-strip": { - x2.aggregate = "count"; - x2.title = language.count; - const stripProps = { - sortOrder: "ascending", - orientation: "horizontal", - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - break; - } - default: { - x2.aggregate = "count"; - x2.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: "down-right", - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: "Square", - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: "y", - binnable: true, - axisSelection: ((_c2 = specColumns.y) === null || _c2 === void 0 ? void 0 : _c2.quantitative) ? "range" : "exact", - axisSelectionBetweenTicks: true, - signals: [SignalNames.YBins] - }, - { - role: "z", - axisSelection: ((_d2 = specColumns.z) === null || _d2 === void 0 ? void 0 : _d2.quantitative) ? "range" : "exact", - allowNone: true, - disabled: view === "2d" - }, - { - role: "color", - allowNone: true - }, - { - role: "sort", - allowNone: true - }, - { - role: "size", - allowNone: allowNoneForSize, - excludeCategoric: true, - signals: [SignalNames.TreeMapMethod] - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ] - } - }; - } - function barchartV(specContext) { - var _a2, _b2; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: "vertical", - groupby: { - column: specColumns.x, - defaultBins, - maxbinsSignalName: SignalNames.XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins - }, - minBandWidth: minBarBandWidth, - showAxes - }; - const y2 = { title: null }; - const axisScales = { - x: { title: specColumns.x && specColumns.x.name }, - y: y2, - z: { title: specColumns.z && specColumns.z.name } - }; - const layouts = [{ - layoutType: "Band", - props: bandProps - }]; - const { totalStyle, view } = insight; - if (totalStyle === "sum-strip-percent") { - y2.aggregate = "percent"; - y2.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: "descending", - orientation: "vertical", - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: "bottom", - globalAggregateMaxExtentSignal: "aggMaxExtent", - globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: "AggregateContainer", - props: aggProps - }); - switch (totalStyle) { - case "sum-treemap": { - y2.aggregate = "sum"; - y2.title = language.sum; - const treemapProps = { - corner: "bottom-left", - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Treemap", - props: treemapProps - }); - break; - } - case "sum-strip": { - y2.aggregate = "sum"; - y2.title = language.sum; - const stripProps = { - sortOrder: "descending", - orientation: "vertical", - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - break; - } - case "count-strip": { - y2.aggregate = "count"; - y2.title = language.count; - const stripProps = { - sortOrder: "descending", - orientation: "vertical", - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - break; - } - default: { - y2.aggregate = "count"; - y2.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: "right-up", - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: "Square", - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: "x", - binnable: true, - axisSelection: ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", - axisSelectionBetweenTicks: true, - signals: [SignalNames.XBins] - }, - { - role: "z", - axisSelection: ((_b2 = specColumns.z) === null || _b2 === void 0 ? void 0 : _b2.quantitative) ? "range" : "exact", - allowNone: true, - disabled: view === "2d" - }, - { - role: "color", - allowNone: true - }, - { - role: "sort", - allowNone: true - }, - { - role: "size", - allowNone: allowNoneForSize, - excludeCategoric: true, - signals: [SignalNames.TreeMapMethod] - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ] - } - }; - } - function density(specContext) { - var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { title: (_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.name }, - y: { title: (_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.name }, - z: { title: (_c2 = specColumns.z) === null || _c2 === void 0 ? void 0 : _c2.name } - }; - const backgroundImage = ((_d2 = specColumns.x) === null || _d2 === void 0 ? void 0 : _d2.quantitative) && ((_e2 = specColumns.y) === null || _e2 === void 0 ? void 0 : _e2.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: "horizontal", - groupby: { - column: specColumns.y, - defaultBins, - maxbinsSignalName: SignalNames.YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins - }, - minBandWidth: minBarBandWidth, - showAxes, - outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: "vertical", - groupby: { - column: specColumns.x, - defaultBins, - maxbinsSignalName: SignalNames.XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins - }, - minBandWidth: minBarBandWidth, - showAxes, - outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } - }; - const aggProps = { - onBuild: null, - aggregation: null, - sumBy: specColumns.size - }; - const layouts = [ - { - layoutType: "Band", - props: vBandProps - }, - { - layoutType: "Band", - props: hBandProps - }, - { - layoutType: "AggregateSquare", - props: aggProps - } - ]; - const { totalStyle, view } = insight; - switch (totalStyle) { - case "sum-treemap": { - aggProps.aggregation = "sum"; - const treemapProps = { - corner: "bottom-left", - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Treemap", - props: treemapProps - }); - break; - } - case "sum-strip": { - aggProps.aggregation = "sum"; - const stripProps = { - sortOrder: "ascending", - orientation: "vertical", - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - break; - } - case "count-strip": { - aggProps.aggregation = "count"; - const stripProps = { - sortOrder: "ascending", - orientation: "vertical", - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - break; - } - default: { - aggProps.aggregation = "count"; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: "right-down", - z: specColumns.z, - maxGroupedUnits: null, - maxGroupedFillSize: null, - showAxes, - view - }; - aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled) => { - squareProps.maxGroupedUnits = aggMaxExtent; - squareProps.maxGroupedFillSize = aggMaxExtentScaled; - }; - layouts.push({ - layoutType: "Square", - props: squareProps - }); - break; - } - } - return { - axisScales, - layouts, - specCapabilities: { - backgroundImage: true, - countsAndSums: true, - roles: [ - { - role: "x", - binnable: true, - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", - axisSelectionBetweenTicks: true, - signals: [SignalNames.XBins] - }, - { - role: "y", - binnable: true, - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact", - axisSelectionBetweenTicks: true, - signals: [SignalNames.YBins] - }, - { - role: "z", - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", - allowNone: true, - disabled: view === "2d" - }, - { - role: "color", - allowNone: true - }, - { - role: "sort", - allowNone: true - }, - { - role: "size", - allowNone: allowNoneForSize, - excludeCategoric: true, - signals: [SignalNames.TreeMapMethod] - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ] - } - }; - } - function grid(specContext) { - var _a2; - const { insight, specColumns } = specContext; - const { view } = insight; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: "right-down", - z: specColumns.z, - collapseYHeight: true, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { title: specColumns.z && specColumns.z.name } - }; - return { - axisScales, - layouts: [ - { - layoutType: "Square", - props: squareProps - } - ], - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: "z", - axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", - allowNone: true, - disabled: view === "2d" - }, - { - role: "color", - allowNone: true - }, - { - role: "sort", - allowNone: true - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ] - } - }; - } - function scatterplot(specContext) { - var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const backgroundImageExtents = ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) && ((_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.quantitative) && ((_c2 = insight.backgroundImage) === null || _c2 === void 0 ? void 0 : _c2.extents); - const scatterProps = { - x: specColumns.x, - y: specColumns.y, - z: specColumns.z, - size: specColumns.size, - scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, - zGrounded: specViewOptions.language.zGrounded, - backgroundImageExtents, - showAxes: !(backgroundImageExtents || insight.hideAxes), - view: insight.view - }; - const axisScales = { - x: { title: (_d2 = specColumns.x) === null || _d2 === void 0 ? void 0 : _d2.name }, - y: { title: (_e2 = specColumns.y) === null || _e2 === void 0 ? void 0 : _e2.name }, - z: { title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name } - }; - return { - axisScales, - layouts: [ - { - layoutType: "Scatter", - props: scatterProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: "x", - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact" - }, - { - role: "y", - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact" - }, - { - role: "z", - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", - allowNone: true, - disabled: false - }, - { - role: "color", - allowNone: true - }, - { - role: "size", - excludeCategoric: true, - allowNone: true - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ], - signals: [SignalNames.PointScale, SignalNames.ZGrounded] - } - }; - } - function stacks(specContext) { - var _a2, _b2, _c2, _d2, _e2, _f, _g; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { title: (_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.name }, - y: { title: (_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.name }, - z: { title: specViewOptions.language.count } - }; - const backgroundImage = ((_c2 = specColumns.x) === null || _c2 === void 0 ? void 0 : _c2.quantitative) && ((_d2 = specColumns.y) === null || _d2 === void 0 ? void 0 : _d2.quantitative) && ((_e2 = insight.backgroundImage) === null || _e2 === void 0 ? void 0 : _e2.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: "horizontal", - groupby: { - column: specColumns.y, - defaultBins, - maxbinsSignalName: SignalNames.YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins - }, - minBandWidth: minBarBandWidth, - showAxes, - outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: "vertical", - groupby: { - column: specColumns.x, - defaultBins, - maxbinsSignalName: SignalNames.XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins - }, - minBandWidth: minBarBandWidth, - showAxes, - outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } - }; - const stackProps = { - sort: specColumns.sort, - showAxes - }; - return { - axisScales, - customZScale: true, - layouts: [ - { - layoutType: "Band", - props: vBandProps - }, - { - layoutType: "Band", - props: hBandProps - }, - { - layoutType: "Stack", - props: stackProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: "x", - binnable: true, - axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? "range" : "exact", - axisSelectionBetweenTicks: true, - signals: [SignalNames.XBins] - }, - { - role: "y", - binnable: true, - axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", - axisSelectionBetweenTicks: true, - signals: [SignalNames.YBins] - }, - { - role: "color", - allowNone: true - }, - { - role: "sort", - allowNone: true - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ] - } - }; - } - function strips(specContext) { - var _a2; - const { insight, specColumns } = specContext; - const { view } = insight; - const stripProps = { - sortOrder: "ascending", - orientation: "vertical", - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { title: specColumns.z && specColumns.z.name } - }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: specColumns.size ? "sum" : "count" - }; - const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; - const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; - const props = { - dock: "top", - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: "AggregateContainer", - props - }); - } - layouts.push({ - layoutType: "Strip", - props: stripProps - }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: "size", - allowNone: true, - //size by none is a count - excludeCategoric: true - }, - { - role: "z", - axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", - allowNone: true, - disabled: view === "2d" - }, - { - role: "color", - allowNone: true - }, - { - role: "sort", - allowNone: true - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ] - } - }; - } - function treemap$1(specContext) { - var _a2; - const { insight, specColumns, specViewOptions } = specContext; - const { view } = insight; - const treemapProps = { - corner: "top-left", - group: specColumns.group, - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { title: specColumns.z && specColumns.z.name } - }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: "sum" - }; - const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; - const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; - const props = { - dock: "top", - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: "AggregateContainer", - props - }); - } - layouts.push({ - layoutType: "Treemap", - props: treemapProps - }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: "size", - excludeCategoric: true - }, - { - role: "group", - allowNone: true - }, - { - role: "z", - axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", - allowNone: true, - disabled: view === "2d" - }, - { - role: "color", - allowNone: true - }, - { - role: "facet", - allowNone: true, - signals: [SignalNames.FacetBins] - }, - { - role: "facetV", - allowNone: true, - signals: [SignalNames.FacetVBins] - } - ], - signals: [SignalNames.TreeMapMethod] - } - }; - } - function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { - let layoutPair; - const groupby = facetColumn; - const plotPadding = { - x: 0, - y: 0 - }; - let facetPadding; - switch (facetStyle) { - case "cross": { - const props = { - axisTextColor, - colRowTitles: true, - groupbyX: groupby, - groupbyY: facetVColumn - }; - layoutPair = { - layoutType: "Cross", - props - }; - facetPadding = { - bottom: facetPaddingBottom, - left: facetPaddingLeft, - top: 0 - }; - plotPadding.y = facetPaddingTop; - plotPadding.x = facetPaddingRight; - break; - } - case "wrap": - default: { - const props = { - axisTextColor, - cellTitles: true, - groupby - }; - layoutPair = { - layoutType: "Wrap", - props - }; - facetPadding = { - bottom: facetPaddingBottom, - left: facetPaddingLeft, - top: facetPaddingTop - }; - break; - } - } - const facetLayout = { - facetPadding, - plotPadding - }; - return { - layoutPair, - facetLayout - }; - } - const map$4 = { - barchart: barchartV, - barchartH, - barchartV, - density, - grid, - scatterplot, - stacks, - strips, - treemap: treemap$1 - }; - function getSpecBuilderPropsForChart(specContext) { - const { insight, specColumns, specViewOptions } = specContext; - const fn2 = map$4[insight.chart]; - if (fn2) { - const props = fn2(specContext); - if (insight.columns.facet) { - const discreteFacetColumn = { - column: specColumns.facet, - defaultBins, - maxbins, - maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, - maxbinsSignalName: SignalNames.FacetBins - }; - const discreteFacetVColumn = { - column: specColumns.facetV, - defaultBins, - maxbins, - maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, - maxbinsSignalName: SignalNames.FacetVBins - }; - const { facetLayout, layoutPair } = getFacetLayout(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); - props.layouts.unshift(layoutPair); - props.facetLayout = facetLayout; - props.collapseFacetAxes = specViewOptions.collapseFacetAxes; - } - return props; - } - } - function define2(constructor, factory, prototype2) { - constructor.prototype = factory.prototype = prototype2; - prototype2.constructor = constructor; - } - function extend$1(parent, definition2) { - var prototype2 = Object.create(parent.prototype); - for (var key2 in definition2) prototype2[key2] = definition2[key2]; - return prototype2; - } - function Color$2() { - } - var darker = 0.7; - var brighter = 1 / darker; - var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); - var named = { - aliceblue: 15792383, - antiquewhite: 16444375, - aqua: 65535, - aquamarine: 8388564, - azure: 15794175, - beige: 16119260, - bisque: 16770244, - black: 0, - blanchedalmond: 16772045, - blue: 255, - blueviolet: 9055202, - brown: 10824234, - burlywood: 14596231, - cadetblue: 6266528, - chartreuse: 8388352, - chocolate: 13789470, - coral: 16744272, - cornflowerblue: 6591981, - cornsilk: 16775388, - crimson: 14423100, - cyan: 65535, - darkblue: 139, - darkcyan: 35723, - darkgoldenrod: 12092939, - darkgray: 11119017, - darkgreen: 25600, - darkgrey: 11119017, - darkkhaki: 12433259, - darkmagenta: 9109643, - darkolivegreen: 5597999, - darkorange: 16747520, - darkorchid: 10040012, - darkred: 9109504, - darksalmon: 15308410, - darkseagreen: 9419919, - darkslateblue: 4734347, - darkslategray: 3100495, - darkslategrey: 3100495, - darkturquoise: 52945, - darkviolet: 9699539, - deeppink: 16716947, - deepskyblue: 49151, - dimgray: 6908265, - dimgrey: 6908265, - dodgerblue: 2003199, - firebrick: 11674146, - floralwhite: 16775920, - forestgreen: 2263842, - fuchsia: 16711935, - gainsboro: 14474460, - ghostwhite: 16316671, - gold: 16766720, - goldenrod: 14329120, - gray: 8421504, - green: 32768, - greenyellow: 11403055, - grey: 8421504, - honeydew: 15794160, - hotpink: 16738740, - indianred: 13458524, - indigo: 4915330, - ivory: 16777200, - khaki: 15787660, - lavender: 15132410, - lavenderblush: 16773365, - lawngreen: 8190976, - lemonchiffon: 16775885, - lightblue: 11393254, - lightcoral: 15761536, - lightcyan: 14745599, - lightgoldenrodyellow: 16448210, - lightgray: 13882323, - lightgreen: 9498256, - lightgrey: 13882323, - lightpink: 16758465, - lightsalmon: 16752762, - lightseagreen: 2142890, - lightskyblue: 8900346, - lightslategray: 7833753, - lightslategrey: 7833753, - lightsteelblue: 11584734, - lightyellow: 16777184, - lime: 65280, - limegreen: 3329330, - linen: 16445670, - magenta: 16711935, - maroon: 8388608, - mediumaquamarine: 6737322, - mediumblue: 205, - mediumorchid: 12211667, - mediumpurple: 9662683, - mediumseagreen: 3978097, - mediumslateblue: 8087790, - mediumspringgreen: 64154, - mediumturquoise: 4772300, - mediumvioletred: 13047173, - midnightblue: 1644912, - mintcream: 16121850, - mistyrose: 16770273, - moccasin: 16770229, - navajowhite: 16768685, - navy: 128, - oldlace: 16643558, - olive: 8421376, - olivedrab: 7048739, - orange: 16753920, - orangered: 16729344, - orchid: 14315734, - palegoldenrod: 15657130, - palegreen: 10025880, - paleturquoise: 11529966, - palevioletred: 14381203, - papayawhip: 16773077, - peachpuff: 16767673, - peru: 13468991, - pink: 16761035, - plum: 14524637, - powderblue: 11591910, - purple: 8388736, - rebeccapurple: 6697881, - red: 16711680, - rosybrown: 12357519, - royalblue: 4286945, - saddlebrown: 9127187, - salmon: 16416882, - sandybrown: 16032864, - seagreen: 3050327, - seashell: 16774638, - sienna: 10506797, - silver: 12632256, - skyblue: 8900331, - slateblue: 6970061, - slategray: 7372944, - slategrey: 7372944, - snow: 16775930, - springgreen: 65407, - steelblue: 4620980, - tan: 13808780, - teal: 32896, - thistle: 14204888, - tomato: 16737095, - turquoise: 4251856, - violet: 15631086, - wheat: 16113331, - white: 16777215, - whitesmoke: 16119285, - yellow: 16776960, - yellowgreen: 10145074 - }; - define2(Color$2, color$2, { - copy(channels) { - return Object.assign(new this.constructor(), this, channels); - }, - displayable() { - return this.rgb().displayable(); - }, - hex: color_formatHex, - // Deprecated! Use color.formatHex. - formatHex: color_formatHex, - formatHex8: color_formatHex8, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb - }); - function color_formatHex() { - return this.rgb().formatHex(); - } - function color_formatHex8() { - return this.rgb().formatHex8(); - } - function color_formatHsl() { - return hslConvert(this).formatHsl(); - } - function color_formatRgb() { - return this.rgb().formatRgb(); - } - function color$2(format2) { - var m2, l; - format2 = (format2 + "").trim().toLowerCase(); - return (m2 = reHex.exec(format2)) ? (l = m2[1].length, m2 = parseInt(m2[1], 16), l === 6 ? rgbn(m2) : l === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; - } - function rgbn(n) { - return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); - } - function rgba(r, g, b2, a2) { - if (a2 <= 0) r = g = b2 = NaN; - return new Rgb(r, g, b2, a2); - } - function rgbConvert(o) { - if (!(o instanceof Color$2)) o = color$2(o); - if (!o) return new Rgb(); - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); - } - function rgb$1(r, g, b2, opacity2) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b2, opacity2 == null ? 1 : opacity2); - } - function Rgb(r, g, b2, opacity2) { - this.r = +r; - this.g = +g; - this.b = +b2; - this.opacity = +opacity2; - } - define2(Rgb, rgb$1, extend$1(Color$2, { - brighter(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb() { - return this; - }, - clamp() { - return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); - }, - displayable() { - return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); - }, - hex: rgb_formatHex, - // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatHex8: rgb_formatHex8, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb - })); - function rgb_formatHex() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; - } - function rgb_formatHex8() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; - } - function rgb_formatRgb() { - const a2 = clampa(this.opacity); - return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`; - } - function clampa(opacity2) { - return isNaN(opacity2) ? 1 : Math.max(0, Math.min(1, opacity2)); - } - function clampi(value2) { - return Math.max(0, Math.min(255, Math.round(value2) || 0)); - } - function hex(value2) { - value2 = clampi(value2); - return (value2 < 16 ? "0" : "") + value2.toString(16); - } - function hsla(h2, s2, l, a2) { - if (a2 <= 0) h2 = s2 = l = NaN; - else if (l <= 0 || l >= 1) h2 = s2 = NaN; - else if (s2 <= 0) h2 = NaN; - return new Hsl(h2, s2, l, a2); - } - function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color$2)) o = color$2(o); - if (!o) return new Hsl(); - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, min2 = Math.min(r, g, b2), max2 = Math.max(r, g, b2), h2 = NaN, s2 = max2 - min2, l = (max2 + min2) / 2; - if (s2) { - if (r === max2) h2 = (g - b2) / s2 + (g < b2) * 6; - else if (g === max2) h2 = (b2 - r) / s2 + 2; - else h2 = (r - g) / s2 + 4; - s2 /= l < 0.5 ? max2 + min2 : 2 - max2 - min2; - h2 *= 60; - } else { - s2 = l > 0 && l < 1 ? 0 : h2; - } - return new Hsl(h2, s2, l, o.opacity); - } - function hsl$1(h2, s2, l, opacity2) { - return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l, opacity2 == null ? 1 : opacity2); - } - function Hsl(h2, s2, l, opacity2) { - this.h = +h2; - this.s = +s2; - this.l = +l; - this.opacity = +opacity2; - } - define2(Hsl, hsl$1, extend$1(Color$2, { - brighter(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb() { - var h2 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s2, m1 = 2 * l - m2; - return new Rgb( - hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2), - hsl2rgb(h2, m1, m2), - hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2), - this.opacity - ); - }, - clamp() { - return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); - }, - displayable() { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); - }, - formatHsl() { - const a2 = clampa(this.opacity); - return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`; - } - })); - function clamph(value2) { - value2 = (value2 || 0) % 360; - return value2 < 0 ? value2 + 360 : value2; - } - function clampt(value2) { - return Math.max(0, Math.min(1, value2 || 0)); - } - function hsl2rgb(h2, m1, m2) { - return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255; - } - const radians$1 = Math.PI / 180; - const degrees$2 = 180 / Math.PI; - const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0$2 = 4 / 29, t1$1 = 6 / 29, t2 = 3 * t1$1 * t1$1, t3 = t1$1 * t1$1 * t1$1; - function labConvert(o) { - if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); - if (o instanceof Hcl) return hcl2lab(o); - if (!(o instanceof Rgb)) o = rgbConvert(o); - var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b2 = rgb2lrgb(o.b), y2 = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b2) / Yn), x2, z2; - if (r === g && g === b2) x2 = z2 = y2; - else { - x2 = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b2) / Xn); - z2 = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b2) / Zn); - } - return new Lab(116 * y2 - 16, 500 * (x2 - y2), 200 * (y2 - z2), o.opacity); - } - function lab$1(l, a2, b2, opacity2) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a2, b2, opacity2 == null ? 1 : opacity2); - } - function Lab(l, a2, b2, opacity2) { - this.l = +l; - this.a = +a2; - this.b = +b2; - this.opacity = +opacity2; - } - define2(Lab, lab$1, extend$1(Color$2, { - brighter(k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker(k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb() { - var y2 = (this.l + 16) / 116, x2 = isNaN(this.a) ? y2 : y2 + this.a / 500, z2 = isNaN(this.b) ? y2 : y2 - this.b / 200; - x2 = Xn * lab2xyz(x2); - y2 = Yn * lab2xyz(y2); - z2 = Zn * lab2xyz(z2); - return new Rgb( - lrgb2rgb(3.1338561 * x2 - 1.6168667 * y2 - 0.4906146 * z2), - lrgb2rgb(-0.9787684 * x2 + 1.9161415 * y2 + 0.033454 * z2), - lrgb2rgb(0.0719453 * x2 - 0.2289914 * y2 + 1.4052427 * z2), - this.opacity - ); - } - })); - function xyz2lab(t) { - return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$2; - } - function lab2xyz(t) { - return t > t1$1 ? t * t * t : t2 * (t - t0$2); - } - function lrgb2rgb(x2) { - return 255 * (x2 <= 31308e-7 ? 12.92 * x2 : 1.055 * Math.pow(x2, 1 / 2.4) - 0.055); - } - function rgb2lrgb(x2) { - return (x2 /= 255) <= 0.04045 ? x2 / 12.92 : Math.pow((x2 + 0.055) / 1.055, 2.4); - } - function hclConvert(o) { - if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); - if (!(o instanceof Lab)) o = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h2 = Math.atan2(o.b, o.a) * degrees$2; - return new Hcl(h2 < 0 ? h2 + 360 : h2, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); - } - function hcl$1(h2, c2, l, opacity2) { - return arguments.length === 1 ? hclConvert(h2) : new Hcl(h2, c2, l, opacity2 == null ? 1 : opacity2); - } - function Hcl(h2, c2, l, opacity2) { - this.h = +h2; - this.c = +c2; - this.l = +l; - this.opacity = +opacity2; - } - function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h2 = o.h * radians$1; - return new Lab(o.l, Math.cos(h2) * o.c, Math.sin(h2) * o.c, o.opacity); - } - define2(Hcl, hcl$1, extend$1(Color$2, { - brighter(k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker(k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb() { - return hcl2lab(this).rgb(); - } - })); - var A = -0.14861, B$1 = 1.78277, C$1 = -0.29227, D$1 = -0.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C$1 - D$1 * A; - function cubehelixConvert(o) { - if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Rgb)) o = rgbConvert(o); - var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, l = (BC_DA * b2 + ED * r - EB * g) / (BC_DA + ED - EB), bl2 = b2 - l, k = (E * (g - l) - C$1 * bl2) / D$1, s2 = Math.sqrt(k * k + bl2 * bl2) / (E * l * (1 - l)), h2 = s2 ? Math.atan2(k, bl2) * degrees$2 - 120 : NaN; - return new Cubehelix(h2 < 0 ? h2 + 360 : h2, s2, l, o.opacity); - } - function cubehelix$1(h2, s2, l, opacity2) { - return arguments.length === 1 ? cubehelixConvert(h2) : new Cubehelix(h2, s2, l, opacity2 == null ? 1 : opacity2); - } - function Cubehelix(h2, s2, l, opacity2) { - this.h = +h2; - this.s = +s2; - this.l = +l; - this.opacity = +opacity2; - } - define2(Cubehelix, cubehelix$1, extend$1(Color$2, { - brighter(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb() { - var h2 = isNaN(this.h) ? 0 : (this.h + 120) * radians$1, l = +this.l, a2 = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh2 = Math.cos(h2), sinh2 = Math.sin(h2); - return new Rgb( - 255 * (l + a2 * (A * cosh2 + B$1 * sinh2)), - 255 * (l + a2 * (C$1 * cosh2 + D$1 * sinh2)), - 255 * (l + a2 * (E * cosh2)), - this.opacity - ); - } - })); - function isColor(cssColorSpecifier) { - return !!color$2(cssColorSpecifier); - } - function checkIsColorData(data2, column) { - if (!column.stats.hasColorData) { - column.isColorData = false; - return; - } - for (let i = 0; i < data2.length; i++) { - if (!isColor(data2[i][column.name])) { - column.isColorData = false; - return; - } - } - column.isColorData = true; - } - function isQuantitative(column) { - return column.type === "number" || column.type === "integer"; - } - function detectNegative(columnName, data2) { - for (let i = 1; i < data2.length; i++) { - const value2 = columnName == null ? data2[i] : data2[i][columnName]; - if (value2 < 0) - return true; - } - return false; - } - function detectSequentialColumn(columnName, data2) { - if (data2.length < 2) - return false; - for (let i = 1; i < data2.length; i++) { - const curr = columnName == null ? data2[i] : data2[i][columnName]; - const prev = columnName == null ? data2[i - 1] : data2[i - 1][columnName]; - if (curr !== prev + 1) - return false; - } - return true; - } - function getStats(data2, ...args) { - let columnName; - let columnType; - let columnQuantitative; - let distinctValuesCallback; - if (args.length <= 2) { - const column = args[0]; - columnName = column.name; - columnType = column.type; - columnQuantitative = column.quantitative; - distinctValuesCallback = args[1]; - } else { - columnName = args[0]; - columnType = args[1]; - columnQuantitative = args[2]; - distinctValuesCallback = args[3]; - } - const distinctMap = {}; - const stats = { - nonNull: 0, - distinctValueCount: null, - max: null, - mean: null, - min: null - }; - const columnIsString = columnType === "string"; - let sum2 = 0; - for (let i = 0; i < data2.length; i++) { - const row = data2[i]; - const value2 = columnName == null ? row : row[columnName]; - if (columnIsString) { - if (value2 !== "") { - stats.nonNull++; - } - } else if (value2 != null) { - stats.nonNull++; - } - const num = +value2; - distinctMap[value2] = true; - if (!isNaN(num)) { - if (stats.max === null || num > stats.max) { - stats.max = num; - } - if (stats.min === null || num < stats.min) { - stats.min = num; - } - sum2 += num; - } - if ((columnType === "date" || columnIsString) && !stats.hasColorData && isColor(value2)) { - stats.hasColorData = true; - } - } - if (columnQuantitative) { - stats.mean = data2.length > 0 && sum2 / data2.length; - stats.hasNegative = detectNegative(columnName, data2); - if (columnType === "integer") { - stats.isSequential = detectSequentialColumn(columnName, data2); - } - } - const distinctValues = Object.keys(distinctMap); - if (distinctValuesCallback) { - distinctValues.sort(); - distinctValuesCallback(distinctValues); - } - stats.distinctValueCount = distinctValues.length; - return stats; - } - function getColumnsFromData(inferTypesFn, data2, columnTypes) { - const sample = data2[0]; - const fields = sample ? Object.keys(sample) : []; - const inferences = Object.assign(Object.assign({}, inferTypesFn(data2, fields)), columnTypes); - const columns = fields.map((name) => { - const column = { - name, - type: inferences[name] - }; - return column; - }); - inferAll(columns, data2); - return columns; - } - function inferAll(columns, data2) { - columns.forEach((column) => { - if (column) { - if (typeof column.quantitative !== "boolean") { - column.quantitative = isQuantitative(column); - } - if (!column.stats) { - column.stats = getStats(data2, column); - } - if ((column.type === "date" || column.type === "string") && typeof column.isColorData !== "boolean") { - checkIsColorData(data2, column); - } - } - }); - } - let Table$2 = class Table { - constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = "right") { - this.columns = columns; - this.rows = rows; - this.maxWidth = maxWidth; - this.underlineHeaders = underlineHeaders; - this.align = align; - this.columnWidths = this.columns.map((col, idx) => Math.max(col.length, ...this.rows.map((row) => { - var _a2; - return ((_a2 = row[idx]) === null || _a2 === void 0 ? void 0 : _a2.length) || 0; - }))); - } - createSpaces(num) { - return " ".repeat(num); - } - groupColumns() { - let cumulativeWidth = 0; - const columnGroups = []; - let currentGroup = []; - this.columns.forEach((col, idx) => { - const columnSpace = this.columnWidths[idx] + 1; - if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { - columnGroups.push(currentGroup); - cumulativeWidth = columnSpace; - currentGroup = [col]; - } else { - cumulativeWidth += columnSpace; - currentGroup.push(col); - } - }); - if (currentGroup.length > 0) { - columnGroups.push(currentGroup); - } - return columnGroups; - } - formatRow(row, group2) { - return group2.map((col) => { - const idx = this.columns.indexOf(col); - const cellValue = row[idx] == null ? "" : row[idx].toString(); - return this.align === "right" ? cellValue.padStart(this.columnWidths[idx], " ") : cellValue.padEnd(this.columnWidths[idx], " "); - }).join(this.createSpaces(1)); - } - formatHeader(group2) { - return group2.map((col) => { - const idx = this.columns.indexOf(col); - return this.align === "right" ? col.padStart(this.columnWidths[idx], " ") : col.padEnd(this.columnWidths[idx], " "); - }).join(this.createSpaces(1)); - } - underlineHeader(group2) { - return group2.map((col) => "-".repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); - } - render() { - const output2 = []; - const columnGroups = this.groupColumns(); - columnGroups.forEach((group2, groupIndex) => { - const headerRow = this.formatHeader(group2); - let section = headerRow + (groupIndex < columnGroups.length - 1 ? " \\" : "") + "\n"; - if (this.underlineHeaders) { - section += this.underlineHeader(group2) + "\n"; - } - this.rows.forEach((row) => { - section += this.formatRow(row, group2) + "\n"; - }); - output2.push(section); - if (groupIndex < columnGroups.length - 1) { - output2.push("\n"); - } - }); - return output2.join(""); - } - }; - var pandasSimulation; - (function(pandasSimulation2) { - const typeMapping = { - boolean: "bool", - number: "float64", - // Assuming 'number' is used for floating-point numbers - date: "datetime64[ns]", - string: "object", - integer: "int64" - }; - function head(columns, data2, maxWidth = 80) { - const numRows = 5; - const top = data2.slice(0, numRows); - const rowNumbers = Array.from({ length: numRows }, (_, i) => (i + 1).toString()); - const columnNames = [""].concat(columns.map((col) => col.name)); - const rows = top.map((row, i) => [rowNumbers[i]].concat(columns.map((col) => { - var _a2; - return ((_a2 = row[col.name]) === null || _a2 === void 0 ? void 0 : _a2.toString()) || ""; - }))); - const table = new Table$2(columnNames, rows, maxWidth, false, "right"); - return table.render(); - } - pandasSimulation2.head = head; - function info2(columns, data2, maxWidth = 80) { - const numRows = data2.length; - const output2 = []; - output2.push(""); - output2.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); - output2.push(`Data columns (total ${columns.length} columns): -`); - const columnHeaders = ["#", "Column", "Non-Null Count", "Dtype"]; - const rows = columns.map((col, idx) => { - const nonNullCount = col.stats.nonNull.toString(); - const dtype = typeMapping[col.type] || "unknown"; - return [idx.toString(), col.name, `${nonNullCount} non-null`, dtype]; - }); - const table = new Table$2(columnHeaders, rows, maxWidth, true, "left"); - output2.push(table.render()); - const memoryUsage = columns.reduce((total, col) => { - var _a2; - const exampleValue = (_a2 = data2.find((row) => row[col.name] != null)) === null || _a2 === void 0 ? void 0 : _a2[col.name]; - if (exampleValue == null) - return total; - const size = new Blob([exampleValue.toString()]).size; - return total + size * numRows; - }, 0); - output2.push(` -dtypes: ${columns.filter((col) => col.type === "number").length} float64, ${columns.filter((col) => col.type === "integer").length} int64, ${columns.filter((col) => col.type === "string").length} object`); - output2.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); - return output2.join("\n"); - } - pandasSimulation2.info = info2; - })(pandasSimulation || (pandasSimulation = {})); - function getSpecColumns(insight, columns) { - function getColumnByName(name) { - return columns.filter((c2) => c2.name === name)[0]; - } - return { - color: getColumnByName(insight.columns && insight.columns.color), - facet: getColumnByName(insight.columns && insight.columns.facet), - facetV: getColumnByName(insight.columns && insight.columns.facetV), - group: getColumnByName(insight.columns && insight.columns.group), - size: getColumnByName(insight.columns && insight.columns.size), - sort: getColumnByName(insight.columns && insight.columns.sort), - uid: getColumnByName(insight.columns && insight.columns.uid), - x: getColumnByName(insight.columns && insight.columns.x), - y: getColumnByName(insight.columns && insight.columns.y), - z: getColumnByName(insight.columns && insight.columns.z) - }; - } - function addAxes(scope, ...axes) { - if (!axes || !axes.length) - return; - if (!scope.axes) - scope.axes = []; - scope.axes.push(...axes.filter(Boolean)); - } - function addData(scope, ...datas) { - if (!datas || !datas.length) - return; - if (!scope.data) - scope.data = []; - scope.data.push(...datas.filter(Boolean)); - } - function addMarks(scope, ...marks) { - if (!marks || !marks.length) - return; - if (!scope.marks) - scope.marks = []; - scope.marks.push(...marks.filter(Boolean)); - } - function addScales(scope, ...scales2) { - if (!scales2 || !scales2.length) - return; - if (!scope.scales) - scope.scales = []; - scope.scales.push(...scales2.filter(Boolean)); - } - function addSignals(scope, ...signals) { - if (!signals || !signals.length) - return; - if (!scope.signals) - scope.signals = []; - scope.signals.push(...signals.filter(Boolean)); - } - function addTransforms(data2, ...transforms2) { - if (!transforms2 || !transforms2.length) - return; - if (!data2.transform) - data2.transform = []; - data2.transform.push(...transforms2.filter(Boolean)); - } - function getDataByName(data2, dataName) { - for (let i = 0; i < data2.length; i++) { - if (data2[i].name === dataName) - return { data: data2[i], index: i }; - } - } - function getGroupBy(groupings) { - const groupby = groupings.map((g) => g.groupby); - return groupby.reduce((acc, val) => acc.concat(val), []); - } - function addOffsets(...offsets2) { - return offsets2.filter(Boolean).join(" + "); - } - function addGlobalAxes(props) { - const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; - const { scope } = globalScope; - allGlobalScales.forEach((globalScales) => { - const { scales: scales2 } = globalScales; - for (const xyz in scales2) { - const _scales = scales2[xyz]; - if (_scales) { - addScales(scope, ..._scales); - let { showAxes } = globalScales; - let zindex = void 0; - if (xyz === "z") { - showAxes = false; - if (props.view === "3d" && specViewOptions.zAxisOptions && !props.hideZAxis) { - if (specViewOptions.zAxisOptions.showZAxis) { - showAxes = true; - zindex = specViewOptions.zAxisOptions.zIndex; - } - } - } - if (showAxes && axisScales) { - const axisScale = axisScales[xyz]; - if (axisScale) { - const lineColor = specViewOptions.colors.axisLine; - const horizontal = xyz === "x"; - const column = specColumns[xyz] || { quantitative: true }; - const title = axisScale.title; - const props2 = { - title, - horizontal, - column, - specViewOptions, - lineColor, - titlePadding: axesTitlePadding[xyz], - labelBaseline: labelBaseline[xyz], - zindex - }; - axesScopes["main"].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); - if (axesScopes[xyz]) { - axesScopes[xyz].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); - } - if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { - const plotOffsetSignal = plotOffsetSignals[xyz]; - plotOffsetSignal.update = `${axesOffsets[xyz]}`; - } - } - } - } - } - }); - } - function createAxis(props) { - const { column, horizontal, labelBaseline, lineColor, scale: scale2, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; - const axis = Object.assign(Object.assign(Object.assign(Object.assign({ zindex, scale: scale2.name, orient: horizontal ? "bottom" : "left", domain: showLines, ticks: showLines }, showLines && { - domainColor: lineColor, - tickColor: lineColor, - tickSize: specViewOptions.tickSize - }), showTitle && { - title, - titleAlign: horizontal ? "left" : "right", - titleAngle: { - signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY - }, - titleColor: specViewOptions.colors.axisText, - titleFontSize: { - signal: SignalNames.TextTitleSize - }, - titleLimit: axesTitleLimit, - titlePadding - }), { labels: showLabels }), showLabels && { - labelAlign: horizontal ? "left" : "right", - labelBaseline, - labelAngle: { - signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY - }, - labelColor: specViewOptions.colors.axisText, - labelFontSize: { - signal: SignalNames.TextSize - }, - labelLimit: axesLabelLimit - }); - if (column.quantitative) { - axis.format = "~r"; - } - return axis; - } - function safeFieldName(field2) { - return field2.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"').replace(/\./g, "\\.").replace(/\[/g, "\\[").replace(/\]/g, "\\]"); - } - function exprSafeFieldName(field2) { - return field2.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ""); - } - function linearScale(scaleName, domain2, range2, reverse2, zero2, nice2 = true) { - const scale2 = { - name: scaleName, - type: "linear", - range: range2, - round: true, - reverse: reverse2, - domain: domain2, - zero: zero2, - nice: nice2 - }; - return scale2; - } - function pointScale(scaleName, data2, range2, field2, reverse2) { - const scale2 = { - name: scaleName, - type: "point", - range: range2, - domain: { - data: data2, - field: safeFieldName(field2), - sort: true - }, - padding: 0.5 - }; - if (reverse2 !== void 0) { - scale2.reverse = reverse2; - } - return scale2; - } - function binnableColorScale(scaleName, colorBin, data2, field2, scheme2) { - scheme2 = scheme2 || ColorScaleNone; - const domain2 = { - data: data2, - field: safeFieldName(field2) - }; - const range2 = { - scheme: scheme2 - }; - const reverse2 = { signal: SignalNames.ColorReverse }; - if (colorBin !== "continuous") { - range2.count = { signal: SignalNames.ColorBinCount }; - } - switch (colorBin) { - case "continuous": { - const sequentialScale = { - name: scaleName, - type: "linear", - domain: domain2, - range: range2, - reverse: reverse2 - }; - return sequentialScale; - } - case "quantile": { - const quantileScale = { - name: scaleName, - type: "quantile", - domain: domain2, - range: range2, - reverse: reverse2 - }; - return quantileScale; - } - default: { - const quantizeScale = { - name: scaleName, - type: "quantize", - domain: domain2, - range: range2, - reverse: reverse2 - }; - return quantizeScale; - } - } - } - const defaultZProportion = 0.6; - function textSignals(context2, heightSignal) { - const { specViewOptions } = context2; - const signals = [ - { - name: SignalNames.ZProportion, - value: defaultZProportion, - bind: { - name: specViewOptions.language.zScaleProportion, - debounce: debounce$1, - input: "range", - min: 0.1, - max: 2, - step: 0.1 - } - }, - { - name: SignalNames.ZHeight, - update: `${heightSignal} * ${SignalNames.ZProportion}` - }, - { - name: SignalNames.TextScale, - value: 1.2, - bind: { - name: specViewOptions.language.textScaleSignal, - debounce: debounce$1, - input: "range", - min: 0.5, - max: 2, - step: 0.1 - } - }, - { - name: SignalNames.TextSize, - update: `${SignalNames.TextScale} * 10` - }, - { - name: SignalNames.TextTitleSize, - update: `${SignalNames.TextScale} * 15` - }, - { - name: SignalNames.TextAngleX, - value: 30, - bind: { - name: specViewOptions.language.xAxisTextAngleSignal, - debounce: debounce$1, - input: "range", - min: 0, - max: 90, - step: 1 - } - }, - { - name: SignalNames.TextAngleY, - value: 0, - bind: { - name: specViewOptions.language.yAxisTextAngleSignal, - debounce: debounce$1, - input: "range", - min: -90, - max: 0, - step: 1 - } - }, - { - name: SignalNames.MarkOpacity, - value: 1, - bind: { - name: specViewOptions.language.markOpacitySignal, - debounce: debounce$1, - input: "range", - min: 0.1, - max: 1, - step: 0.05 - } - } - ]; - return signals; - } - function colorBinCountSignal(context2) { - const { specViewOptions } = context2; - const signal = { - name: SignalNames.ColorBinCount, - value: 7, - bind: { - name: specViewOptions.language.colorBinCount, - debounce: debounce$1, - input: "range", - min: 1, - max: specViewOptions.maxLegends + 1, - step: 1 - } - }; - return signal; - } - function colorReverseSignal(context2) { - const { specViewOptions } = context2; - const signal = { - name: SignalNames.ColorReverse, - value: false, - bind: { - name: specViewOptions.language.colorReverse, - input: "checkbox" - } - }; - return signal; - } - function modifySignal(s2, fn2, update2) { - s2.update = `${fn2}((${s2.update}), (${update2}))`; - } - function legend(column, fill2) { - const legend2 = { - orient: "none", - title: column.name, - fill: fill2, - encode: { - symbols: { - update: { - shape: { - value: "square" - } - } - } - } - }; - if (column.quantitative) { - legend2.type = "symbol"; - legend2.format = "~r"; - } - return legend2; - } - function getLegends(context2, fill2) { - const { specColumns, insight } = context2; - if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) { - return [legend(specColumns.color, fill2)]; - } - } - function topLookup(column, count2, source2, legend2, lookupName, fieldName, indexName) { - const data2 = [ - { - name: lookupName, - source: source2, - transform: [ - { - type: "aggregate", - groupby: [safeFieldName(column.name)] - }, - { - type: "window", - ops: ["count"], - as: [indexName] - }, - { - type: "filter", - expr: `datum[${JSON.stringify(indexName)}] <= ${count2}` - } - ] - }, - { - name: legend2, - source: source2, - transform: [ - { - type: "lookup", - from: lookupName, - key: safeFieldName(column.name), - fields: [column.name].map(safeFieldName), - values: [column.name].map(safeFieldName), - as: [fieldName] - }, - { - type: "formula", - expr: `datum[${JSON.stringify(fieldName)}] == null ? '${Other}' : datum[${JSON.stringify(fieldName)}]`, - as: fieldName - } - ] - } - ]; - return data2; - } - function addColor(props) { - const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; - let colorDataName = dataName; - const { insight, specColumns, specViewOptions } = specContext; - const legends = getLegends(specContext, scaleName); - if (legends) { - scope.legends = legends; - } - const categoricalColor = specColumns.color && !specColumns.color.quantitative; - if (categoricalColor) { - addData(scope, ...topLookup(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, FieldNames.TopColor, FieldNames.TopIndex)); - colorDataName = legendDataName; - } - if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) { - if (specColumns.color.quantitative) { - addScales(scope, binnableColorScale(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); - } else { - addScales(scope, { - name: scaleName, - type: "ordinal", - domain: { - data: colorDataName, - field: FieldNames.TopColor, - sort: true - }, - range: { - scheme: insight.scheme || ColorScaleNone - }, - reverse: { signal: colorReverseSignalName } - }); - } - } - addSignals(scope, colorBinCountSignal(specContext), colorReverseSignal(specContext)); - return { topColorField: FieldNames.TopColor, colorDataName }; - } - function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { - const titleSignal = `parent[${JSON.stringify(FieldNames.FacetTitle)}]`; - const index2 = `datum[${JSON.stringify(FieldNames.Ordinal)}] - 1`; - const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index2); - const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index2); - addMarks(globalScope, col.header, row.footer); - addMarks(col.header, { - type: "text", - encode: { - enter: { - align: { - value: "center" - }, - baseline: { - value: "middle" - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` - }, - x: { - signal: `${sizeSignals.layoutWidth} / 2` - }, - limit: { - signal: sizeSignals.layoutWidth - }, - fontSize: { - signal: SignalNames.TextSize - }, - text: { - signal: titleSignal - } - } - } - }); - addMarks(row.footer, { - type: "text", - encode: { - enter: { - align: { - value: "left" - }, - baseline: { - value: "middle" - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` - }, - y: { - signal: `${sizeSignals.layoutHeight} / 2` - }, - limit: { - signal: SignalNames.PlotOffsetRight - }, - fontSize: { - signal: SignalNames.TextSize - }, - text: { - signal: titleSignal - } - } - } - }); - } - function addFacetCellTitles(scope, sizeSignals, axisTextColor) { - addMarks(scope, { - type: "text", - encode: { - enter: { - align: { - value: "center" - }, - baseline: { - value: "bottom" - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` - }, - x: { - signal: `(${sizeSignals.layoutWidth}) / 2` - }, - text: { - signal: `parent[${JSON.stringify(FieldNames.FacetTitle)}]` - }, - fontSize: { - signal: SignalNames.TextSize - }, - limit: { - signal: sizeSignals.layoutWidth - }, - y: { - signal: `-${SignalNames.FacetPaddingTop} / 2` - } - } - } - }); - } - function addFacetAxesGroupMarks(props) { - const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; - const { sizeSignals } = facetScope; - const colSequence = createSequence(colSeqName, sizeSignals.colCount); - const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); - const index2 = "datum.data"; - const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index2); - const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index2); - addData(globalScope, colSequence, rowSequence); - addMarks(globalScope, col.footer, row.header); - addScales(globalScope, colTitleScale, rowTitleScale); - const map2 = { - main: [ - { - scope: facetScope.facetScope, - lines: true, - labels: false, - title: false - } - ], - x: [ - { - scope: col.footer, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: colTitleScale, - lines: false, - labels: false, - title: true - } - ], - y: [ - { - scope: row.header, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: rowTitleScale, - lines: false, - labels: false, - title: true - } - ] - }; - return map2; - } - function facetRowHeaderFooter(data2, sizeSignals, index2) { - const rowFn = (xSignal) => { - return { - type: "group", - from: { data: data2 }, - encode: { - update: { - x: { signal: xSignal }, - y: { - signal: `${SignalNames.PlotOffsetTop} + ${SignalNames.FacetPaddingTop} + (${index2}) * (${sizeSignals.layoutHeight} + ${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})` - }, - height: { signal: sizeSignals.layoutHeight } - } - } - }; - }; - const header = rowFn(SignalNames.PlotOffsetLeft); - const footer = rowFn(`${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetRight} / 2`); - return { header, footer }; - } - function facetColumnHeaderFooter(data2, sizeSignals, index2) { - const colFn = (ySignal) => { - return { - type: "group", - from: { data: data2 }, - encode: { - update: { - x: { - signal: `(${index2}) * (${sizeSignals.layoutWidth} + ${SignalNames.FacetPaddingLeft}) + ${SignalNames.FacetPaddingLeft} + ${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` - }, - y: { signal: `${ySignal} - ${SignalNames.FacetAxesAdjustY}` }, - width: { signal: sizeSignals.layoutWidth } - } - } - }; - }; - const header = colFn(`${SignalNames.PlotOffsetTop} / 2`); - const footer = colFn(`${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut}`); - return { header, footer }; - } - function createSequence(dataName, countSignal) { - return { - name: dataName, - transform: [ - { - type: "sequence", - start: 0, - stop: { - signal: countSignal - } - } - ] - }; - } - function fill$1(context2, colorFieldName, scale2) { - const { specColumns, insight, specViewOptions } = context2; - const colorColumn = specColumns.color; - return colorColumn ? colorColumn.isColorData || insight.directColor ? { - field: safeFieldName(colorColumn.name) - } : { - scale: scale2, - field: colorColumn.quantitative ? safeFieldName(colorColumn.name) : colorFieldName - } : { - value: specViewOptions.colors.defaultCube - }; - } - function opacity(context2) { - const result = { - signal: SignalNames.MarkOpacity - }; - return result; - } - class GlobalScope { - constructor(props) { - const { dataName, markGroup, scope, signals } = props; - this.scope = scope; - this._markGroup = markGroup; - this.signals = signals; - this.data = getDataByName(scope.data, dataName).data; - this._markDataName = dataName; - this.offsets = { - x: "0", - y: "0", - h: SignalNames.PlotHeightIn, - w: SignalNames.PlotWidthIn - }; - this.sizeSignals = { - layoutHeight: SignalNames.PlotHeightIn, - layoutWidth: SignalNames.PlotWidthIn - }; - this.zSize = SignalNames.PlotHeightIn; - } - get markDataName() { - return this._markDataName; - } - setMarkDataName(markDataName) { - this._markDataName = markDataName; - } - get markGroup() { - return this._markGroup; - } - setMarkGroup(markGroup) { - this._markGroup = markGroup; - } - } - class Layout { - constructor(props) { - this.props = props; - this.id = props.id; - } - getGrouping() { - return null; - } - getAggregateSumOp() { - return null; - } - build() { - throw "Not implemented"; - } - } - function testForCollapseSelection() { - return `datum.${FieldNames.Collapsed}`; - } - class AggregateContainer extends Layout { - constructor(props) { - super(props); - this.props = props; - const a2 = this.aggregation = this.getAggregation(); - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a2}_extent`, - scale: `scale_${p}`, - extentData: `data_${p}_extent`, - offsets: `data_${p}_offsets` - }; - } - getAggregateSumOp() { - if (this.aggregation === "sum") { - const fieldOp = { - field: safeFieldName(this.props.sumBy.name), - op: "sum", - as: FieldNames.Sum - }; - return fieldOp; - } - } - build() { - const { aggregation, names, props } = this; - const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; - addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { - type: "extent", - field: safeFieldName(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - addSignals(globalScope.scope, { - name: props.globalAggregateMaxExtentSignal, - update: `${names.globalAggregateExtentSignal}[1]` - }); - const horizontal = dock === "left"; - const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; - const offsets2 = { - x: parentScope.offsets.x, - y: addOffsets(parentScope.offsets.y, dock === "bottom" ? groupScaled : ""), - h: horizontal ? parentScope.offsets.h : dock === "top" ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, - w: horizontal ? groupScaled : parentScope.offsets.w - }; - const scale2 = { - type: "linear", - name: names.scale, - domain: [ - 0, - { - signal: props.globalAggregateMaxExtentSignal - } - ], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ], - nice: niceScale, - zero: true, - reverse: dock === "top" - }; - const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; - addSignals(globalScope.scope, { - name: props.globalAggregateMaxExtentScaledSignal, - update: dock === "bottom" ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue - }); - return { - offsets: offsets2, - sizeSignals: horizontal ? { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: null - } : { - layoutHeight: null, - layoutWidth: parentScope.sizeSignals.layoutWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? [scale2] : void 0, - y: horizontal ? void 0 : [scale2] - } - }, - encodingRuleMap: horizontal ? { - x: [{ - test: testForCollapseSelection(), - signal: parentScope.offsets.x - }], - width: [{ - test: testForCollapseSelection(), - value: 0 - }] - } : { - y: [{ - test: testForCollapseSelection(), - signal: dock === "top" ? parentScope.offsets.y : addOffsets(parentScope.offsets.y, parentScope.offsets.h) - }], - height: [{ - test: testForCollapseSelection(), - value: 0 - }] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: "joinaggregate", - groupby: groupby.map(safeFieldName), - ops: [aggregation] - }; - if (aggregation === "sum") { - trans.fields = [this.props.sumBy.name].map(safeFieldName); - } - return trans; - } - getAggregation() { - const { props } = this; - let s2; - if (props.dock === "left") { - s2 = props.axesScales.x; - } else { - s2 = props.axesScales.y; - } - switch (s2.aggregate) { - case "sum": - return "sum"; - default: - return "count"; - } - } - } - class AggregateSquare extends Layout { - constructor(props) { - super(props); - this.props = props; - const a2 = this.props.aggregation; - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a2}_extent`, - extentData: `data_${p}_extent` - }; - } - build() { - const { names, props } = this; - const { aggregation, globalScope, groupings, onBuild, parentScope } = props; - const { sizeSignals } = parentScope; - addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { - type: "extent", - field: safeFieldName(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; - const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; - const squareMaxArea = `(${[squareMaxSide, squareMaxSide].join(" * ")})`; - const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; - const squareArea = `(${[squareMaxArea, shrinkRatio].join(" * ")})`; - const squareSide = `sqrt(${squareArea})`; - const localAggregateMaxExtentScaled = squareSide; - onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); - const offsets2 = { - x: addOffsets(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), - y: addOffsets(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), - h: squareSide, - w: squareSide - }; - return { - offsets: offsets2, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - encodingRuleMap: { - y: [{ - test: testForCollapseSelection(), - signal: offsets2.y - }], - height: [{ - test: testForCollapseSelection(), - value: 0 - }] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: "joinaggregate", - groupby: groupby.map(safeFieldName), - ops: [aggregation] - }; - if (aggregation === "sum") { - trans.fields = [this.props.sumBy.name].map(safeFieldName); - } - return trans; - } - } - function dataExtent(column, signal) { - return { - type: "extent", - field: safeFieldName(column.name), - signal - }; - } - function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { - const { column, defaultBins: defaultBins2, maxbins: maxbins2, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; - if (column.quantitative) { - const field2 = `${prefix}_bin_${exprSafeFieldName(column.name)}`; - const fieldEnd = `${field2}_end`; - const binSignal = `${field2}_bins`; - const dataExtentSignal = `${field2}_bin_extent`; - const dataExtentSpanSignal = `${field2}_bin_extent_span`; - const outerSignal = `${field2}_outer_extent`; - domainDataName = `${field2}_sequence`; - const extentTransform = dataExtent(column, dataExtentSignal); - let imageSignal; - if (outerSignalExtents) { - imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); - } - const maxbinsSignal = { - name: maxbinsSignalName, - value: defaultBins2, - bind: { - name: maxbinsSignalDisplayName, - debounce: debounce$1, - input: "range", - min: 1, - max: maxbins2, - step: 1 - } - }; - const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; - const binTransform = { - type: "bin", - field: safeFieldName(column.name), - as: [ - field2, - fieldEnd - ], - signal: binSignal, - extent: { - signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` - //add a tiny bit to the upper extent to force the extra bin - https://github.com/vega/vega/issues/2899 - }, - minstep: shouldBeIntegralBinStep(column) ? 1 : 0, - maxbins: { - signal: maxbinsSignalName - } - }; - const dataSequence = { - name: domainDataName, - transform: [ - { - type: "sequence", - start: { - signal: `${binSignal}.start` - }, - stop: { - signal: `${binSignal}.stop` - }, - step: { - signal: `${binSignal}.step` - } - }, - { - type: "formula", - expr: "datum.data", - as: field2 - }, - { - type: "formula", - expr: `datum.data + ${binSignal}.step`, - as: fieldEnd - }, - { - type: "window", - ops: ["row_number"], - as: [FieldNames.Ordinal] - }, - { - type: "formula", - expr: `datum.data === ${binSignal}.start`, - as: FieldNames.First - }, - { - type: "formula", - expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, - as: FieldNames.Last - }, - { - // when there is only one bin, use only first sequence element - type: "filter", - expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify(FieldNames.First)}] : true` - } - ] - }; - const signals = [ - maxbinsSignal, - { - name: dataExtentSpanSignal, - update: `${extentSignal}[1] - ${extentSignal}[0]` - } - ]; - if (imageSignal) { - signals.push(imageSignal); - } - const augmentBinnable = { - discreteColumn, - native: false, - transforms: [extentTransform, binTransform], - fields: [field2, fieldEnd], - binSignal, - extentSignal, - dataSequence, - domainDataName, - signals, - fullScaleDataname: dataSequence.name - }; - return augmentBinnable; - } else { - const nativeBinnable = { - discreteColumn, - native: true, - fields: [column.name], - domainDataName, - fullScaleDataname: domainDataName - }; - return nativeBinnable; - } - } - function outerExtentSignal(name, min2, max2, dataExtent2) { - return { - name, - update: `[min(${min2}, ${dataExtent2}[0]), max(${max2}, ${dataExtent2}[1])]` - }; - } - function shouldBeIntegralBinStep(column) { - return column.quantitative && (column.type === "integer" && column.stats.max - column.stats.min <= 7); - } - const bandScaleLinearSuffix = "_linear"; - let Band$1 = class Band extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `band_${this.id}`; - this.names = { - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - bandWidth: `${p}_bandwidth`, - accumulative: `${p}_accumulative` - }; - this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); - } - getGrouping() { - return this.bin.fields; - } - build() { - const { bin: bin2, names, props } = this; - const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; - const binField = bin2.fields[0]; - if (bin2.native === false) { - addSignals(globalScope.scope, ...bin2.signals); - addTransforms(globalScope.data, ...bin2.transforms); - addData(globalScope.scope, bin2.dataSequence); - } - addData(globalScope.scope, { - name: names.accumulative, - source: bin2.fullScaleDataname, - transform: [ - { - type: "aggregate", - groupby: this.getGrouping().map(safeFieldName), - ops: ["count"] - } - ] - }); - const horizontal = orientation === "horizontal"; - const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; - modifySignal(minCellSignal, "max", `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); - addSignals(globalScope.scope, { - name: names.bandWidth, - update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` - }); - const scale2 = this.getScale(bin2, horizontal); - if (props.outerSignalExtents && bin2.native === false) { - addScales(globalScope.scope, linearScale(scale2.name + bandScaleLinearSuffix, { signal: bin2.extentSignal }, scale2.range, scale2.reverse, false, false)); - } - let encodingRuleMap; - if (!props.excludeEncodingRuleMap) { - encodingRuleMap = horizontal ? { - x: [ - { - test: testForCollapseSelection(), - signal: parentScope.offsets.x - } - ], - width: [ - { - test: testForCollapseSelection(), - value: 0 - } - ] - } : { - y: [ - { - test: testForCollapseSelection(), - signal: addOffsets(parentScope.offsets.y, parentScope.offsets.h) - } - ], - height: [ - { - test: testForCollapseSelection(), - value: 0 - } - ] - }; - } - return { - offsets: this.getOffset(horizontal, binField), - sizeSignals: horizontal ? { - layoutHeight: names.bandWidth, - layoutWidth: parentScope.sizeSignals.layoutWidth - } : { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: names.bandWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? void 0 : [scale2], - y: horizontal ? [scale2] : void 0 - } - }, - encodingRuleMap - }; - } - getOffset(horizontal, binField) { - const { names, props } = this; - const { parentScope } = props; - return { - x: addOffsets(parentScope.offsets.x, horizontal ? "" : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), - y: addOffsets(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ""), - h: horizontal ? names.bandWidth : parentScope.offsets.h, - w: horizontal ? parentScope.offsets.w : names.bandWidth - }; - } - getScale(bin2, horizontal) { - const { names } = this; - const { parentScope } = this.props; - const binField = safeFieldName(bin2.fields[0]); - let bandScale; - if (horizontal) { - bandScale = { - type: "band", - name: names.yScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutHeight - } - ], - padding: 0.1, - domain: { - data: bin2.domainDataName, - field: binField, - sort: true - }, - reverse: true - }; - } else { - bandScale = { - type: "band", - name: names.xScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ], - padding: 0.1, - domain: { - data: bin2.domainDataName, - field: binField, - sort: true - } - }; - } - return bandScale; - } - }; - function displayBin(bin2) { - const val = (index2) => `datum[${JSON.stringify(bin2.fields[index2])}]`; - return bin2.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); - } - function obj(nameValues, clause) { - return `{${nameValues.join()}}`; - } - function serializeAsVegaExpression(bin2, firstFieldName, lastFieldName, clause) { - if (bin2.discreteColumn.column.quantitative) { - const low = [ - `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, - "operator:'>='", - `value:datum[${JSON.stringify(bin2.fields[0])}]` - ]; - const high = [ - "clause:'&&'", - `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, - "operator:'<'", - `value:datum[${JSON.stringify(bin2.fields[1])}]` - ]; - return obj([ - `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]` - ]); - } else { - const exact = [ - `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, - "operator:'=='", - `value:datum[${JSON.stringify(bin2.fields[0])}]` - ]; - return obj([ - `expressions:[${obj(exact)}]` - ]); - } - } - function createOrdinals(source2, prefix, binFields, sortOrder) { - const _binFields = binFields.map(safeFieldName); - const dataName = `${prefix}_bin_order`; - const data2 = { - name: dataName, - source: source2, - transform: [ - { - type: "aggregate", - groupby: _binFields - }, - { - type: "collect", - sort: { - field: _binFields, - order: _binFields.map((f) => sortOrder) - } - }, - { - type: "window", - ops: ["row_number"], - as: [FieldNames.Ordinal] - } - ] - }; - return { - data: data2, - scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) - }; - } - function ordinalScale(dataName, scaleName, binFields) { - return { - type: "ordinal", - name: scaleName, - domain: { - data: dataName, - field: safeFieldName(binFields[0]) - }, - range: { - data: dataName, - field: FieldNames.Ordinal - } - }; - } - let Cross$1 = class Cross extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `cross_${this.id}`; - this.binX = binnable(`${p}_x`, props.globalScope.data.name, props.groupbyX); - this.binY = binnable(`${p}_y`, props.globalScope.data.name, props.groupbyY); - this.names = { - facetDataName: `data_${p}_facet`, - searchUnion: `data_${p}_search`, - dimScale: `scale_${p}`, - dimCount: `${p}_count`, - dimCategorical: `data_${p}_cat`, - dimCellSize: `${p}_cell_size`, - dimCellSizeCalc: `${p}_cell_calc` - }; - } - getGrouping() { - return this.binX.fields.concat(this.binY.fields); - } - build() { - const { binX, binY, names, prefix, props } = this; - const { axisTextColor, colRowTitles, globalScope, parentScope } = props; - const titles = { x: { dataName: null, quantitative: null }, y: { dataName: null, quantitative: null } }; - const dx = { - dim: "x", - bin: binX, - sortOrder: "ascending", - size: parentScope.sizeSignals.layoutWidth, - layout: parentScope.sizeSignals.layoutWidth, - min: globalScope.signals.minCellWidth.name, - out: globalScope.signals.plotWidthOut, - offset: SignalNames.FacetPaddingLeft, - padding: SignalNames.FacetPaddingLeft, - dataOut: null, - scaleName: null, - position: null - }; - const dy = { - dim: "y", - bin: binY, - sortOrder: "ascending", - size: parentScope.sizeSignals.layoutHeight, - layout: parentScope.sizeSignals.layoutHeight, - min: globalScope.signals.minCellHeight.name, - out: globalScope.signals.plotHeightOut, - offset: SignalNames.FacetPaddingTop, - padding: `(${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})`, - dataOut: null, - scaleName: null, - position: null - }; - const dimensions = [dx, dy]; - dimensions.forEach((d2) => { - const { bin: bin2, dim, padding: padding2, sortOrder } = d2; - let data2; - let dataName; - let countSignal; - let scale2; - const titleSource = titles[dim]; - if (bin2.native === false) { - addSignals(globalScope.scope, ...bin2.signals); - addTransforms(globalScope.data, ...bin2.transforms); - addData(globalScope.scope, bin2.dataSequence); - addTransforms(bin2.dataSequence, { - type: "formula", - expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, - as: FieldNames.Contains - }); - data2 = bin2.dataSequence; - dataName = bin2.dataSequence.name; - countSignal = `length(data(${JSON.stringify(dataName)}))`; - scale2 = ordinalScale(dataName, `${names.dimScale}_${dim}`, bin2.fields); - titleSource.dataName = bin2.dataSequence.name; - } else { - dataName = globalScope.markDataName; - const ord = createOrdinals(dataName, `${prefix}_${dim}`, bin2.fields, sortOrder); - data2 = ord.data; - addData(globalScope.scope, ord.data); - countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; - scale2 = ord.scale; - titleSource.dataName = ord.data.name; - } - titleSource.quantitative = bin2.discreteColumn.column.quantitative; - d2.dataOut = data2; - d2.scaleName = scale2.name; - addTransforms(data2, { - type: "formula", - expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), - as: FieldNames.FacetSearch - }, { - type: "formula", - expr: displayBin(bin2), - as: FieldNames.FacetTitle - }); - addScales(globalScope.scope, scale2); - const count2 = `${names.dimCount}_${dim}`; - const calc = `${names.dimCellSizeCalc}_${dim}`; - const size = `${names.dimCellSize}_${dim}`; - addSignals(globalScope.scope, { name: count2, update: countSignal }); - addSignals(globalScope.scope, { - name: calc, - update: `${d2.layout} / ${count2}` - }, { - name: size, - update: `max(${d2.min}, (${calc} - ${padding2}))` - }); - modifySignal(d2.out, "max", `((${size} + ${padding2}) * ${count2})`); - d2.position = this.dimensionOffset(d2); - }); - const groupRow = { - type: "group", - encode: { - update: { - y: { - signal: dy.position - } - } - }, - from: { - data: dy.dataOut.name - }, - data: [ - { - name: names.searchUnion, - source: dx.dataOut.name, - transform: [ - { - type: "formula", - expr: `[datum[${JSON.stringify(FieldNames.FacetSearch)}], merge(parent[${JSON.stringify(FieldNames.FacetSearch)}], { clause: '&&'})]`, - as: FieldNames.FacetSearch - } - ] - } - ] - }; - const groupCol = { - style: "cell", - name: prefix, - type: "group", - encode: { - update: { - height: { - signal: `${names.dimCellSize}_y` - }, - width: { - signal: `${names.dimCellSize}_x` - }, - x: { - signal: dx.position - } - } - }, - from: { - data: names.searchUnion - } - }; - addMarks(globalScope.markGroup, groupRow); - addMarks(groupRow, groupCol); - const offsets2 = { - x: this.dimensionOffset(dx), - y: this.dimensionOffset(dy), - h: `${names.dimCellSize}_y`, - w: `${names.dimCellSize}_x` - }; - const sizeSignals = { - layoutHeight: `${names.dimCellSize}_y`, - layoutWidth: `${names.dimCellSize}_x`, - colCount: `${names.dimCount}_x`, - rowCount: `${names.dimCount}_y` - }; - if (colRowTitles) { - addFacetColRowTitles(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); - } - return { - facetScope: groupCol, - offsets: offsets2, - sizeSignals, - titles - }; - } - dimensionOffset(d2) { - const { names } = this; - return `${d2.offset} + (scale(${JSON.stringify(d2.scaleName)}, datum[${JSON.stringify(d2.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d2.dim} + ${d2.padding})`; - } - }; - let Scatter$1 = class Scatter extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `scatter_${this.id}`; - this.names = { - aggregateData: `data_${p}_aggregate`, - markData: `data_${p}_mark`, - xDataExtent: `${p}_xDataExtent`, - yDataExtent: `${p}_yDataExtent`, - xExtent: `${p}_xExtent`, - yExtent: `${p}_yExtent`, - sizeExtent: `${p}_sizeExtent`, - sizeRange: `${p}_sizeRange`, - sizeScale: `${p}_sizeScale`, - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x: x2, y: y2, z: z2, zGrounded } = props; - const qsize = size && size.quantitative && size; - addSignals(globalScope.scope, { - name: SignalNames.PointScale, - value: 5, - bind: { - name: scatterPointScaleDisplay, - debounce: debounce$1, - input: "range", - min: 1, - max: 10, - step: 0.1 - } - }, { - name: SignalNames.ZGrounded, - value: false, - bind: { - name: zGrounded, - input: "checkbox" - } - }); - if (backgroundImageExtents) { - addTransforms(globalScope.data, dataExtent(x2, names.xDataExtent), dataExtent(y2, names.yDataExtent)); - const xSignal = outerExtentSignal(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); - const ySignal = outerExtentSignal(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); - addSignals(globalScope.scope, xSignal, ySignal); - } - if (qsize) { - addTransforms(globalScope.data, { - type: "extent", - field: safeFieldName(qsize.name), - signal: names.sizeExtent - }); - addScales(globalScope.scope, { - name: names.sizeScale, - type: "pow", - exponent: 0.5, - domain: [0, { signal: `${names.sizeExtent}[1]` }], - range: [0, { signal: names.sizeRange }] - }); - addSignals(globalScope.scope, { - name: names.sizeRange, - update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${scatterSizedDiv}` - }); - } - addData(globalScope.scope, { - name: names.markData, - source: globalScope.markDataName, - transform: [x2, y2, z2].map((c2) => { - if (!c2 || !c2.quantitative) - return; - const t = { - type: "filter", - expr: `isValid(datum[${JSON.stringify(c2.name)}])` - }; - return t; - }).filter(Boolean) - }); - globalScope.setMarkDataName(names.markData); - const globalScales = { showAxes, scales: {} }; - const zValue = z2 ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z2.name)}])` : null; - const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${SignalNames.PointScale}` : SignalNames.PointScale; - const update2 = Object.assign({ height: [ - { - test: testForCollapseSelection(), - value: 0 - }, - { - signal: sizeValueSignal - } - ], width: { - signal: sizeValueSignal - } }, z2 && { - z: [ - { - test: testForCollapseSelection(), - value: 0 - }, - { - signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` - } - ], - zindex: [ - { - signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` - } - ], - depth: [ - { - test: testForCollapseSelection(), - value: 0 - }, - { - signal: view === "3d" ? `${SignalNames.ZGrounded} ? ${zValue} : ${sizeValueSignal}` : "0" - } - ] - }); - const columnSignals = [ - { - column: x2, - xyz: "x", - scaleName: names.xScale, - domain: backgroundImageExtents ? { - signal: names.xExtent - } : { - data: globalScope.data.name, - field: safeFieldName(x2.name) - }, - reverse: false, - signal: parentScope.sizeSignals.layoutWidth - }, - { - column: y2, - xyz: "y", - scaleName: names.yScale, - domain: backgroundImageExtents ? { - signal: names.yExtent - } : { - data: globalScope.data.name, - field: safeFieldName(y2.name) - }, - reverse: true, - signal: parentScope.sizeSignals.layoutHeight - }, - { - column: z2, - xyz: "z", - scaleName: names.zScale, - domain: { - data: globalScope.data.name, - field: z2 ? safeFieldName(z2.name) : null - }, - reverse: false, - signal: view === "3d" ? `(${globalScope.zSize}) * ${SignalNames.ZProportion}` : `10 * ${SignalNames.ZProportion}` - } - ]; - columnSignals.forEach((cs) => { - const { column, domain: domain2, reverse: reverse2, scaleName, signal, xyz } = cs; - if (!column) - return; - let scale2; - if (column.quantitative) { - scale2 = linearScale(scaleName, domain2, [0, { signal }], reverse2, false, showAxes); - if (shouldBeIntegralBinStep(column)) { - scale2.bins = { step: 1 }; - } - } else { - scale2 = pointScale(scaleName, globalScope.data.name, [0, { signal }], column.name, reverse2); - } - globalScales.scales[xyz] = [scale2]; - }); - const mark = { - name: prefix, - type: "rect", - from: { data: globalScope.markDataName }, - encode: { update: update2 } - }; - addMarks(globalScope.markGroup, mark); - return { - offsets: { - x: addOffsets(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x2.name)}])`), - y: addOffsets(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y2.name)}]) - ${sizeValueSignal}`), - h: sizeValueSignal, - w: sizeValueSignal - }, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - globalScales, - mark, - encodingRuleMap: { - y: [ - { - test: testForCollapseSelection(), - signal: addOffsets(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) - } - ] - } - }; - } - }; - function addZScale(z2, zSize, dataName, zScaleName) { - if (z2) { - const zRange = [0, { signal: `(${zSize}) * ${SignalNames.ZProportion}` }]; - const scale2 = z2.quantitative ? linearScale(zScaleName, { - data: dataName, - field: safeFieldName(z2.name) - }, zRange, false, true) : pointScale(zScaleName, dataName, zRange, z2.name, false); - return scale2; - } - } - class Square extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `square_${this.id}`; - this.names = { - bandWidth: this.getBandWidth(), - maxGroupField: `${p}_max_group`, - maxGroupSignal: `${p}_max_grouping`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z: z2 } = props; - const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); - addTransforms(globalScope.data, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sortBy && { - sort: { - field: safeFieldName(sortBy.name), - order: "ascending" - } - })); - const { gap, levelSize, size, squaresPerBand } = this.addSignals(); - const heightSignal = { - signal: fillDirection === "down-right" ? size : levelSize - }; - const mark = { - name: prefix, - type: "rect", - from: { - data: globalScope.markDataName - }, - encode: { - update: Object.assign({ height: collapseYHeight ? [ - { - test: testForCollapseSelection(), - value: 0 - }, - heightSignal - ] : heightSignal, width: { - signal: fillDirection === "down-right" ? levelSize : size - } }, z2 && { - z: { value: 0 }, - depth: [ - { - test: testForCollapseSelection(), - value: 0 - }, - view === "3d" ? { - scale: names.zScale, - field: safeFieldName(z2.name) - } : { - value: 0 - } - ] - }) - } - }; - addMarks(globalScope.markGroup, mark); - const { tx: tx2, ty: ty2 } = this.transformXY(gap, levelSize, squaresPerBand); - return Object.assign(Object.assign(Object.assign({}, z2 && { - globalScales: { - showAxes, - scales: { - z: [zScale] - } - } - }), { offsets: { - x: addOffsets(parentScope.offsets.x, tx2.expr), - y: addOffsets(parentScope.offsets.y, ty2.expr), - h: size, - w: size - }, mark, sizeSignals: { - layoutHeight: size, - layoutWidth: size - } }), collapseYHeight && { - encodingRuleMap: { - y: [ - { - test: testForCollapseSelection(), - signal: parentScope.offsets.y - } - ] - } - }); - } - getBandWidth() { - const { offsets: offsets2 } = this.props.parentScope; - switch (this.props.fillDirection) { - case "down-right": - return offsets2.h; - default: - return offsets2.w; - } - } - addSignals() { - const { names, props } = this; - const { fillDirection, globalScope, groupings, parentScope } = props; - let { maxGroupedFillSize, maxGroupedUnits } = props; - if (!maxGroupedUnits) { - if (groupings) { - addTransforms(globalScope.data, { - type: "joinaggregate", - groupby: getGroupBy(groupings).map(safeFieldName), - ops: ["count"], - as: [names.maxGroupField] - }, { - type: "extent", - field: names.maxGroupField, - signal: names.maxGroupSignal - }); - maxGroupedUnits = `(${names.maxGroupSignal}[1])`; - } else { - maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; - } - } - if (!maxGroupedFillSize) { - maxGroupedFillSize = fillDirection === "down-right" ? parentScope.offsets.w : parentScope.offsets.h; - } - const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; - const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; - const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; - const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; - const levels2 = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; - const levelSize = `(((${maxGroupedFillSize}) / ${levels2}) - ${gap})`; - return { gap, levelSize, size, squaresPerBand }; - } - transformXY(gap, levelSize, squaresPerBand) { - const { names, prefix } = this; - const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; - const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; - const { fillDirection, parentScope } = this.props; - const tx2 = { - type: "formula", - expr: null, - as: `${prefix}_${FieldNames.OffsetX}` - }; - const ty2 = { - type: "formula", - expr: null, - as: `${prefix}_${FieldNames.OffsetY}` - }; - switch (fillDirection) { - case "down-right": { - tx2.expr = `${level} * (${levelSize} + ${gap})`; - ty2.expr = compartment; - break; - } - case "right-up": { - tx2.expr = compartment; - ty2.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; - break; - } - case "right-down": - default: { - tx2.expr = compartment; - ty2.expr = `${level} * (${levelSize} + ${gap})`; - break; - } - } - return { tx: tx2, ty: ty2 }; - } - } - let Stack$1 = class Stack extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `stack_${this.id}`; - this.names = { - cube: `${p}_cube`, - globalDataName: `data_${p}_count`, - globalExtent: `${p}_global_extent`, - levelDataName: `data_${p}_level`, - count: `${p}_count`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - sequence: `data_${p}_sequence`, - sides: `${p}_sides`, - size: `${p}_size`, - squared: `${p}_squared`, - maxCount: `${p}_maxCount`, - maxLevels: `${p}_maxLevels`, - zScale: `${p}_zScale` - }; - } - build() { - const { names, props } = this; - const { globalScope, groupings, parentScope, showAxes, sort: sort2 } = props; - const { sizeSignals } = parentScope; - addTransforms(globalScope.data, { - type: "joinaggregate", - groupby: getGroupBy(groupings).map(safeFieldName), - ops: ["count"], - as: [names.count] - }, { - type: "extent", - field: names.count, - signal: names.globalExtent - }, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sort2 && { - sort: { - field: safeFieldName(sort2.name), - order: "ascending" - } - })); - addData(globalScope.scope, { - name: names.sequence, - transform: [ - { - type: "sequence", - start: 1, - stop: { - signal: `sqrt(${names.globalExtent}[1])` - } - }, - { - type: "formula", - expr: "datum.data * datum.data", - as: "squared" - }, - { - type: "formula", - expr: `ceil(${names.globalExtent}[1] / datum.squared)`, - as: "maxlevels" - }, - { - type: "formula", - expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, - as: "side" - }, - { - type: "formula", - expr: "datum.side * datum.maxlevels + datum.maxlevels - 1", - as: "sidecubeheight" - }, - { - type: "formula", - expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, - as: "heightmatch" - }, - { - type: "collect", - sort: { - field: "heightmatch", - order: "ascending" - } - }, - { - type: "window", - ops: ["row_number"] - }, - { - type: "filter", - expr: "datum.row_number === 1" - } - ] - }); - addSignals(globalScope.scope, { - name: names.size, - update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` - }, { - name: names.squared, - update: `data('${names.sequence}')[0].squared` - }, { - name: names.sides, - update: `sqrt(${names.squared})` - }, { - name: names.cube, - update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` - }, { - name: names.maxLevels, - update: `data('${names.sequence}')[0].maxlevels` - }, { - name: names.maxCount, - update: `${names.maxLevels} * ${names.squared}` - }); - const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; - const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; - const cubeX = `(${layerOrdinal} % ${names.sides})`; - const cubeY = `floor(${layerOrdinal} / ${names.sides})`; - const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; - const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; - const offsets2 = { - x: addOffsets(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), - y: addOffsets(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), - h: names.size, - w: names.size - }; - const mark = { - type: "rect", - from: { data: this.names.levelDataName }, - encode: { - update: { - z: { - signal: `${zLevel} * (${names.cube} + 1)` - }, - height: { - signal: names.cube - }, - width: { - signal: names.cube - }, - depth: { - signal: names.cube - } - } - } - }; - addMarks(globalScope.markGroup, mark); - const zScale = { - type: "linear", - name: names.zScale, - domain: [ - 0, - { - signal: names.maxCount - } - ], - range: [ - 0, - { - signal: `${names.maxLevels} * (${names.cube} + 1) - 1` - } - ], - nice: false - }; - return { - offsets: offsets2, - mark, - sizeSignals: { - layoutHeight: names.size, - layoutWidth: names.size - }, - globalScales: { - showAxes, - scales: { - z: [zScale] - } - }, - encodingRuleMap: { - y: [{ - test: testForCollapseSelection(), - signal: parentScope.offsets.y - }], - z: [{ - test: testForCollapseSelection(), - value: 0 - }], - depth: [{ - test: testForCollapseSelection(), - value: 0 - }], - height: [{ - test: testForCollapseSelection(), - value: 0 - }] - } - }; - } - }; - class Strip extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `strip_${this.id}`; - this.names = { - firstField: `${p}${FieldNames.First}`, - lastField: `${p}${FieldNames.Last}`, - valueField: `${p}${FieldNames.Value}`, - scale: `scale_${p}`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort: sort2, sortOrder, parentScope, view, z: z2 } = props; - const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); - const horizontal = orientation === "horizontal"; - const transform2 = []; - if (sort2) { - transform2.push({ - type: "collect", - sort: { - field: safeFieldName(sort2.name), - order: sortOrder - } - }); - } - let stackField; - if (size) { - stackField = size.name; - transform2.push({ - type: "filter", - expr: `datum[${JSON.stringify(size.name)}] > 0` - }); - } else { - stackField = names.valueField; - transform2.push({ - type: "formula", - expr: "1", - as: stackField - }); - } - const stackTransform = { - type: "stack", - field: safeFieldName(stackField), - offset: "normalize", - as: [names.firstField, names.lastField] - }; - if (groupings.length) { - stackTransform.groupby = getGroupBy(groupings).map(safeFieldName); - } - transform2.push(stackTransform); - addTransforms(globalScope.data, ...transform2); - const span2 = [names.lastField, names.firstField].map((f) => `datum[${JSON.stringify(f)}]`).join(" - "); - const offsets2 = { - x: addOffsets(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ""), - y: addOffsets(parentScope.offsets.y, horizontal ? "" : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), - h: horizontal ? parentScope.offsets.h : `(${span2}) * (${parentScope.offsets.h})`, - w: horizontal ? `(${span2}) * (${parentScope.offsets.w})` : parentScope.offsets.w - }; - const mark = { - name: prefix, - type: "rect", - from: { data: globalScope.markDataName }, - encode: { - update: Object.assign({ height: { - signal: offsets2.h - }, width: { - signal: offsets2.w - } }, z2 && { - z: { value: 0 }, - depth: [ - { - test: testForCollapseSelection(), - value: 0 - }, - view === "3d" ? { - scale: names.zScale, - field: safeFieldName(z2.name) - } : { - value: 0 - } - ] - }) - } - }; - addMarks(globalScope.markGroup, mark); - let percentageScale; - if (addPercentageScale) { - percentageScale = [{ - type: "linear", - name: names.scale, - domain: [0, 100], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ] - }]; - } - return { - globalScales: { - showAxes, - scales: { - x: horizontal ? percentageScale : void 0, - y: horizontal ? void 0 : percentageScale, - z: zScale && [zScale] - } - }, - offsets: offsets2, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - mark - }; - } - } - let Treemap$1 = class Treemap extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `treemap_${this.id}`; - this.names = { - dataName: `data_${p}`, - dataHeightWidth: `data_${p}_hw`, - dataExtents: `data_${p}_extents`, - dataFacet: `data_${p}_facet`, - dataFacetMark: `data_${p}_facetMark`, - fieldChildren: `${p}_children`, - fieldDepth: `${p}_depth`, - fieldX0: `${p}_x0`, - fieldX1: `${p}_x1`, - fieldY0: `${p}_y0`, - fieldY1: `${p}_y1`, - fieldHeight: `${p}_h`, - fieldWidth: `${p}_w`, - heightExtent: `${p}_heightExtent`, - widthExtent: `${p}_widthExtent`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, props } = this; - const { globalScope, parentScope, showAxes, treeMapMethod, z: z2 } = props; - const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); - const offsets2 = { - x: addOffsets(parentScope.offsets.x, fn(names.fieldX0)), - y: addOffsets(parentScope.offsets.y, fn(names.fieldY0)), - h: subtract$1(names.fieldY1, names.fieldY0), - w: subtract$1(names.fieldX1, names.fieldX0) - }; - const mark = this.transformedMark(offsets2); - addSignals(globalScope.scope, { - name: SignalNames.TreeMapMethod, - value: "squarify", - bind: { - name: treeMapMethod, - input: "select", - options: [ - "squarify", - "binary" - ] - } - }); - return Object.assign(Object.assign({}, z2 && { - globalScales: { - showAxes, - scales: { - z: [zScale] - } - } - }), { - mark, - offsets: offsets2, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - } - }); - } - transformedMark(offsets2) { - const { names, props } = this; - const { globalScope, groupings, parentScope } = props; - if (groupings.length) { - addData(globalScope.scope, { - name: names.dataHeightWidth, - source: globalScope.markDataName, - transform: [ - { - type: "formula", - expr: parentScope.offsets.h, - as: names.fieldHeight - }, - { - type: "formula", - expr: parentScope.offsets.w, - as: names.fieldWidth - } - ] - }); - const treemapData = { - name: names.dataFacetMark, - source: names.dataFacet - }; - const facets = { - type: "group", - from: { - facet: { - name: names.dataFacet, - data: names.dataHeightWidth, - groupby: getGroupBy(groupings).map(safeFieldName) - } - }, - data: [ - { - name: names.dataExtents, - source: names.dataFacet, - transform: [ - { - type: "extent", - field: names.fieldHeight, - signal: names.heightExtent - }, - { - type: "extent", - field: names.fieldWidth, - signal: names.widthExtent - } - ] - }, - treemapData - ] - }; - globalScope.setMarkDataName(names.dataFacetMark); - addMarks(globalScope.markGroup, facets); - globalScope.setMarkGroup(facets); - this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); - return this.addMark(offsets2, facets, globalScope.markDataName); - } else { - this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); - return this.addMark(offsets2, globalScope.markGroup, globalScope.markDataName); - } - } - addMark(offsets2, markParent, markDataName) { - const { names, prefix, props } = this; - const { view, z: z2 } = props; - const mark = { - name: prefix, - type: "rect", - from: { data: markDataName }, - encode: { - update: Object.assign({ width: { - signal: offsets2.w - }, height: { - signal: offsets2.h - } }, z2 && { - z: { value: 0 }, - depth: [ - { - test: testForCollapseSelection(), - value: 0 - }, - view === "3d" ? { - scale: names.zScale, - field: safeFieldName(z2.name) - } : { - value: 0 - } - ] - }) - } - }; - addMarks(markParent, mark); - return mark; - } - treemapTransform(treemapData, widthSignal, heightSignal) { - const { names, props } = this; - const { group: group2, size } = props; - addTransforms(treemapData, { - type: "filter", - expr: `datum[${JSON.stringify(size.name)}] > 0` - }, { - type: "nest", - keys: [group2 && group2.name || "__NONE__"] - }, { - type: "treemap", - field: safeFieldName(size.name), - sort: { field: "value", order: "descending" }, - round: true, - method: { signal: SignalNames.TreeMapMethod }, - paddingInner: 1, - paddingOuter: 0, - size: [ - { signal: widthSignal }, - { signal: heightSignal } - ], - as: [ - names.fieldX0, - names.fieldY0, - names.fieldX1, - names.fieldY1, - names.fieldDepth, - names.fieldChildren - ] - }); - } - }; - function fn(n) { - return `datum[${JSON.stringify(n)}]`; - } - function subtract$1(...fields) { - return fields.map((n) => fn(n)).join(" - "); - } - class Wrap extends Layout { - constructor(props) { - super(props); - this.props = props; - const p = this.prefix = `wrap_${this.id}`; - this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby); - this.names = { - outputData: `data_${p}_out`, - rowColumnDataName: `data_${p}_row_col`, - cellHeight: `${p}_cellHeight`, - cellWidth: `${p}_cellWidth`, - fits: `${p}_fits`, - target: `${p}_target`, - minArea: `${p}_minArea`, - aspect: `${p}_aspect`, - minAspect: `${p}_minAspect`, - idealAspect: `${p}_idealAspect`, - dataLength: `${p}_dataLength`, - rxc0: `${p}_rxc0`, - rxc1: `${p}_rxc1`, - rxc2: `${p}_rxc2`, - rxc: `${p}_rxc`, - growColCount: `${p}_growColCount`, - growCellWidth: `${p}_growCellWidth`, - fitsArea: `${p}_fitsArea`, - colCount: `${p}_colCount` - }; - } - getGrouping() { - return this.bin.fields; - } - build() { - const { bin: bin2, names, prefix, props } = this; - const { axisTextColor, cellTitles, globalScope, parentScope } = props; - let ordinalBinData; - if (bin2.native === false) { - addSignals(globalScope.scope, ...bin2.signals); - addTransforms(globalScope.data, ...bin2.transforms); - addData(globalScope.scope, bin2.dataSequence); - addTransforms(bin2.dataSequence, { - type: "formula", - expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, - as: FieldNames.Contains - }); - ordinalBinData = bin2.dataSequence.name; - } else { - const ord = createOrdinals(globalScope.data.name, prefix, bin2.fields, "ascending"); - addData(globalScope.scope, ord.data); - ordinalBinData = ord.data.name; - } - addData(globalScope.scope, { - name: names.rxc0, - transform: [ - { - type: "sequence", - start: 1, - stop: { - signal: `ceil(sqrt(${names.dataLength})) + 1` - } - }, - { - type: "formula", - expr: `ceil(${names.dataLength} / datum.data)`, - as: "complement" - } - ] - }, { - name: names.rxc1, - source: names.rxc0, - transform: [ - { - type: "project", - fields: ["data"], - as: ["cols"] - } - ] - }, { - name: names.rxc2, - source: names.rxc0, - transform: [ - { - type: "project", - fields: ["complement"], - as: ["cols"] - } - ] - }, { - name: names.rxc, - source: [names.rxc1, names.rxc2], - transform: [ - { - type: "formula", - expr: `ceil(${names.dataLength} / datum.cols)`, - as: "rows" - }, - { - type: "formula", - expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, - as: "cellw" - }, - { - type: "formula", - expr: `datum.cols === 1 ? max(datum.cellw, ${SignalNames.MinCellWidth}) : datum.cellw`, - as: "cellw" - }, - { - type: "formula", - expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, - as: "cellh" - }, - { - type: "formula", - expr: `datum.rows === 1 ? max(datum.cellh, ${SignalNames.MinCellHeight}) : datum.cellh`, - as: "cellh" - }, - { - type: "formula", - expr: `(datum.cellw >= ${SignalNames.MinCellWidth} && datum.cellh >= ${SignalNames.MinCellHeight})`, - as: "meetsmin" - }, - { - type: "filter", - expr: "datum.meetsmin" - }, - { - type: "formula", - expr: "datum.cellw / datum.cellh", - as: names.aspect - }, - { - type: "formula", - expr: `abs(datum.${names.aspect} - ${names.target})`, - as: names.idealAspect - }, - { - type: "formula", - expr: `${names.dataLength} / (datum.cols * datum.rows)`, - as: "coverage" - }, - { - type: "collect", - sort: { - field: [names.idealAspect, "coverage"], - order: ["ascending", "descending"] - } - } - ] - }, { - name: names.rowColumnDataName, - source: ordinalBinData, - transform: [ - { - type: "formula", - expr: `floor((datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) / ${names.colCount})`, - as: FieldNames.WrapRow - }, - { - type: "formula", - expr: `(datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) % ${names.colCount}`, - as: FieldNames.WrapCol - }, - { - type: "formula", - expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), - as: FieldNames.FacetSearch - }, - { - type: "formula", - expr: displayBin(bin2), - as: FieldNames.FacetTitle - } - ] - }); - const dataOut = { - name: names.outputData, - source: globalScope.data.name, - transform: [ - { - type: "lookup", - from: names.rowColumnDataName, - key: safeFieldName(bin2.fields[0]), - fields: [bin2.fields[0]].map(safeFieldName), - values: [FieldNames.WrapRow, FieldNames.WrapCol] - } - ] - }; - addData(globalScope.scope, dataOut); - globalScope.setMarkDataName(names.outputData); - addSignals(globalScope.scope, { - name: names.minAspect, - update: `${SignalNames.MinCellWidth} / ${SignalNames.MinCellHeight}` - }, { - name: names.target, - update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}` - }, { - name: names.minArea, - update: `${SignalNames.MinCellWidth}*${SignalNames.MinCellHeight}` - }, { - name: names.aspect, - update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` - }, { - name: names.dataLength, - update: `data(${JSON.stringify(ordinalBinData)}).length` - }, { - name: names.growColCount, - update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${SignalNames.MinCellWidth}), 1)` - }, { - name: names.growCellWidth, - update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` - }, { - name: names.fitsArea, - update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` - }, { - name: names.fits, - update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` - }, { - name: names.colCount, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` - }, { - name: names.cellWidth, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` - }, { - name: names.cellHeight, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${SignalNames.MinCellHeight}` - }); - modifySignal(globalScope.signals.plotHeightOut, "max", `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); - modifySignal(globalScope.signals.plotWidthOut, "max", `(${names.cellWidth} * ${names.colCount})`); - const signalH = [names.cellHeight, SignalNames.FacetPaddingTop, SignalNames.FacetPaddingBottom].join(" - "); - const signalW = [names.cellWidth, SignalNames.FacetPaddingLeft].join(" - "); - const signalX = addOffsets(parentScope.offsets.x, `datum[${JSON.stringify(FieldNames.WrapCol)}] * ${names.cellWidth}`, SignalNames.FacetPaddingLeft); - const signalY = addOffsets(parentScope.offsets.y, `datum[${JSON.stringify(FieldNames.WrapRow)}] * ${names.cellHeight}`, SignalNames.FacetPaddingTop); - const update2 = { - height: { - signal: signalH - }, - width: { - signal: signalW - }, - x: { - signal: signalX - }, - y: { - signal: signalY - } - }; - const offsets2 = { - x: signalX, - y: signalY, - h: signalH, - w: signalW - }; - const group2 = { - style: "cell", - name: prefix, - type: "group", - from: { - data: names.rowColumnDataName - }, - encode: { update: update2 } - }; - addMarks(globalScope.markGroup, group2); - const sizeSignals = { - layoutHeight: `(${names.cellHeight} - ${SignalNames.FacetPaddingTop} - ${SignalNames.FacetPaddingBottom})`, - layoutWidth: `(${names.cellWidth} - ${SignalNames.FacetPaddingLeft})`, - colCount: names.colCount, - rowCount: `ceil(${names.dataLength} / ${names.colCount})` - }; - if (cellTitles) { - addFacetCellTitles(group2, sizeSignals, axisTextColor); - } - return { - facetScope: group2, - sizeSignals, - offsets: offsets2 - }; - } - } - const layoutClasses = { - AggregateContainer, - AggregateSquare, - Band: Band$1, - Cross: Cross$1, - Scatter: Scatter$1, - Square, - Stack: Stack$1, - Strip, - Treemap: Treemap$1, - Wrap - }; - function getImageMark(backgroundImage, allGlobalScales) { - const xScale = allGlobalScales.filter((s2) => s2.scales.x)[0].scales.x[0]; - const yScale = allGlobalScales.filter((s2) => s2.scales.y)[0].scales.y[0]; - const [xScaleName, yScaleName] = [xScale, yScale].map((s2) => s2.name + (xScale.type === "band" ? bandScaleLinearSuffix : "")); - return { - type: "image", - encode: { - update: { - url: { - value: backgroundImage.url - }, - aspect: { - value: false - }, - baseline: { - value: "bottom" - }, - height: { - signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) - }, - y: { - signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) - }, - width: { - signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) - }, - x: { - signal: getScaledValue(xScaleName, backgroundImage.extents.left) - } - } - } - }; - } - function getScaledSpan(scaleName, low, high) { - return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; - } - function getScaledValue(scaleName, value2) { - return `scale('${scaleName}', ${value2})`; - } - class SpecBuilder { - constructor(props, specContext) { - this.props = props; - this.specContext = specContext; - this.globalSignals = { - facetAxesAdjustX: { name: SignalNames.FacetAxesAdjustX, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingLeft.toString() : "0" }, - facetAxesAdjustY: { name: SignalNames.FacetAxesAdjustY, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingBottom.toString() : "0" }, - minCellWidth: { - name: SignalNames.MinCellWidth, - update: `${minFacetWidth}` - }, - minCellHeight: { name: SignalNames.MinCellHeight, update: `${minFacetHeight}` }, - plotOffsetLeft: { name: SignalNames.PlotOffsetLeft, update: "0" }, - plotOffsetTop: { name: SignalNames.PlotOffsetTop, update: "0" }, - plotOffsetBottom: { name: SignalNames.PlotOffsetBottom, update: "0" }, - plotOffsetRight: { name: SignalNames.PlotOffsetRight, update: "0" }, - plotHeightOut: { name: SignalNames.PlotHeightOut, update: SignalNames.PlotHeightIn }, - plotWidthOut: { name: SignalNames.PlotWidthOut, update: SignalNames.PlotWidthIn } - }; - } - validate() { - const { specContext } = this; - const { specCapabilities } = this.props; - const { roles } = specCapabilities; - const required2 = roles.filter((r) => { - switch (typeof r.allowNone) { - case "boolean": - return !r.allowNone; - case "undefined": - return true; - case "function": - return !r.allowNone(specContext); - } - }); - const numeric = roles.filter((r) => r.excludeCategoric); - const errors = required2.map((r) => { - if (specContext.specColumns[r.role]) { - return null; - } else { - return `Field ${r.role} is required.`; - } - }).concat(numeric.map((r) => { - if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) { - return `Field ${r.role} must be quantitative.`; - } else { - return null; - } - })).filter(Boolean); - const { backgroundImage } = specContext.insight; - if (backgroundImage && !backgroundImage.extents) { - errors.push("BackgroundImage must have extents."); - } - return errors; - } - build() { - var _a2, _b2; - const { globalSignals, specContext } = this; - const { facetLayout, specCapabilities } = this.props; - const { insight, specColumns, specViewOptions } = specContext; - const dataName = "data_source"; - const { vegaSpec, groupMark } = this.initSpec(dataName); - const { topColorField, colorDataName } = addColor({ - scope: vegaSpec, - dataName, - specContext, - scaleName: ScaleNames.Color, - legendDataName: "data_legend", - topLookupName: "data_topcolorlookup", - colorReverseSignalName: SignalNames.ColorReverse - }); - const globalScope = new GlobalScope({ - dataName: colorDataName, - markGroup: groupMark, - scope: vegaSpec, - signals: globalSignals - }); - if (facetLayout) { - addSignals(vegaSpec, { - name: SignalNames.FacetPaddingBottom, - update: `${facetLayout.facetPadding.bottom}` - }, { - name: SignalNames.FacetPaddingLeft, - update: `${facetLayout.facetPadding.left}` - }, { - name: SignalNames.FacetPaddingTop, - update: `${facetLayout.facetPadding.top}` - }); - globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; - globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; - } - const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope) => { - if (facetLayout && i === 0) { - globalScope.zSize = innerScope.offsets.h; - } - }); - if (specResult) { - return specResult; - } - if (allGlobalScales.length > 0) { - const plotHeightOut = globalSignals.plotHeightOut.name; - const plotWidthOut = globalSignals.plotWidthOut.name; - const colTitleScale = { - type: "linear", - name: "scale_facet_col_title", - domain: [0, 1], - range: [0, { signal: plotWidthOut }] - }; - const rowTitleScale = { - type: "linear", - name: "scale_facet_row_title", - domain: [0, 1], - range: [{ signal: plotHeightOut }, 0] - }; - const facetScope = facetLayout ? firstScope : null; - const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; - if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) && ((_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.quantitative)) { - if (!backgroundGroup.marks) { - backgroundGroup.marks = []; - } - const imageMark = getImageMark(insight.backgroundImage, allGlobalScales); - backgroundGroup.marks.unshift(imageMark); - } - const axesScopes = facetLayout ? addFacetAxesGroupMarks({ - globalScope: globalScope.scope, - plotScope: groupMark, - facetScope, - colTitleScale, - rowTitleScale, - colSeqName: "data_FacetCellColTitles", - rowSeqName: "data_FacetCellRowTitles" - }) : { - main: [{ - scope: groupMark, - lines: true, - labels: true, - title: true - }] - }; - addGlobalAxes({ - globalScope, - allGlobalScales, - axisScales: this.props.axisScales, - plotOffsetSignals: { x: globalSignals.plotOffsetLeft, y: globalSignals.plotOffsetBottom }, - axesOffsets: { x: axesOffsetX, y: axesOffsetY }, - axesTitlePadding: facetLayout ? { x: axesTitlePaddingFacetX, y: axesTitlePaddingFacetY } : { x: axesTitlePaddingX, y: axesTitlePaddingY }, - labelBaseline: { x: "top", y: "middle" }, - specColumns, - specViewOptions, - axesScopes, - hideZAxis: !!facetLayout, - view: insight.view - }); - } - if (finalScope.mark) { - const { update: update2 } = finalScope.mark.encode; - const outputDataName = "output"; - finalScope.mark.from.data = outputDataName; - addData(globalScope.markGroup, { - name: outputDataName, - source: globalScope.markDataName, - transform: [ - { - type: "formula", - expr: finalScope.offsets.x, - as: FieldNames.OffsetX - }, - { - type: "formula", - expr: finalScope.offsets.y, - as: FieldNames.OffsetY - } - ] - }); - update2.x = { - field: FieldNames.OffsetX - }; - update2.y = { - field: FieldNames.OffsetY - }; - allEncodingRules.forEach((map2) => { - for (const key2 in map2) { - if (update2[key2]) { - const arrIn = map2[key2]; - if (!Array.isArray(update2[key2])) { - const value2 = update2[key2]; - const arrOut = []; - update2[key2] = arrOut; - arrIn.forEach((rule2) => arrOut.push(rule2)); - arrOut.push(value2); - } else { - const arrOut = update2[key2]; - arrIn.forEach((rule2) => arrOut.unshift(rule2)); - } - } - } - }); - update2.fill = fill$1(specContext, topColorField, ScaleNames.Color); - update2.opacity = opacity(); - } - return { - specCapabilities, - vegaSpec - }; - } - initSpec(dataName) { - const { globalSignals } = this; - const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; - const { specContext } = this; - const { insight } = specContext; - const groupMark = { - type: "group", - //style: 'cell', - encode: { - update: { - x: { signal: `${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, - y: { signal: SignalNames.PlotOffsetTop }, - height: { signal: `${SignalNames.PlotHeightOut} - ${SignalNames.FacetAxesAdjustY}` }, - width: { signal: `${SignalNames.PlotWidthOut} + ${SignalNames.FacetAxesAdjustX}` } - } - } - }; - const inputDataname = "input"; - const vegaSpec = { - $schema: "https://vega.github.io/schema/vega/v5.json", - //style: 'cell', - data: [{ name: inputDataname }, { name: dataName, source: inputDataname, transform: [] }], - marks: [groupMark], - signals: textSignals(specContext, SignalNames.ViewportHeight).concat([ - minCellWidth, - minCellHeight, - { - name: SignalNames.ViewportHeight, - update: `max(${SignalNames.MinCellHeight}, ${insight.size.height})` - }, - { - name: SignalNames.ViewportWidth, - update: `max(${SignalNames.MinCellWidth}, ${insight.size.width})` - }, - plotOffsetLeft, - plotOffsetTop, - plotOffsetBottom, - plotOffsetRight, - facetAxesAdjustX, - facetAxesAdjustY, - { - name: SignalNames.PlotHeightIn, - update: `${SignalNames.ViewportHeight} - ${SignalNames.PlotOffsetBottom} + ${SignalNames.FacetAxesAdjustY}` - }, - { - name: SignalNames.PlotWidthIn, - update: `${SignalNames.ViewportWidth} - ${SignalNames.PlotOffsetLeft} - ${SignalNames.PlotOffsetRight}` - }, - plotHeightOut, - plotWidthOut, - { - name: "height", - update: `${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut} + ${SignalNames.PlotOffsetBottom} - ${SignalNames.FacetAxesAdjustY}` - }, - { - name: "width", - update: `${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotOffsetRight}` - } - ]) - }; - return { vegaSpec, groupMark }; - } - iterateLayouts(globalScope, onLayoutBuild) { - let specResult; - let parentScope = { - sizeSignals: globalScope.sizeSignals, - offsets: globalScope.offsets - }; - let firstScope; - let childScope; - const groupings = []; - const { layouts, specCapabilities } = this.props; - const allGlobalScales = []; - const allEncodingRules = []; - for (let i = 0; i < layouts.length; i++) { - if (!parentScope) - continue; - const buildProps = { - globalScope, - parentScope, - axesScales: this.props.axisScales, - groupings, - id: i - }; - const layout = this.createLayout(layouts[i], buildProps); - try { - childScope = layout.build(); - childScope.id = i; - const groupby = layout.getGrouping(); - if (groupby) { - groupings.push({ - id: i, - groupby, - fieldOps: [ - { field: null, op: "count", as: FieldNames.Count } - ] - }); - } - const sumOp = layout.getAggregateSumOp(); - if (sumOp) { - groupings[groupings.length - 1].fieldOps.push(sumOp); - } - onLayoutBuild(i, childScope); - } catch (e) { - specResult = { - errors: [e.stack], - specCapabilities, - vegaSpec: null - }; - break; - } - if (childScope && childScope.globalScales) { - allGlobalScales.push(childScope.globalScales); - } - if (childScope.encodingRuleMap) { - allEncodingRules.push(childScope.encodingRuleMap); - } - if (i === 0) { - firstScope = childScope; - } - parentScope = childScope; - } - return { firstScope, finalScope: parentScope, specResult, allGlobalScales, allEncodingRules }; - } - createLayout(layoutPair, buildProps) { - const { layoutType, props } = layoutPair; - const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); - const layoutClass = layoutClasses[layoutType]; - const layout = new layoutClass(layoutBuildProps); - layout.id = buildProps.id; - return layout; - } - } - function build(specContext, currData) { - const { specColumns } = specContext; - const columns = [ - specColumns.color, - specColumns.facet, - specColumns.facetV, - specColumns.group, - specColumns.size, - specColumns.sort, - specColumns.x, - specColumns.y, - specColumns.z - ]; - inferAll(columns, currData); - const specBuilderProps = getSpecBuilderPropsForChart(specContext); - const specBuilder = new SpecBuilder(specBuilderProps, specContext); - let specResult; - if (specBuilder) { - try { - const errors = specBuilder.validate(); - if (errors.length) { - specResult = { - errors, - specCapabilities: specBuilderProps.specCapabilities, - vegaSpec: null - }; - } else { - specResult = specBuilder.build(); - } - } catch (e) { - specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [e.stack] - }; - } - if (!specResult.errors) { - const data0 = specResult.vegaSpec.data[0]; - data0.values = currData; - } - } else { - specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [`could not build spec for ${specContext.insight.chart}`] - }; - } - return specResult; - } - const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - ColorScaleNone, - FieldNames, - Other, - ScaleNames, - SignalNames, - build, - getColumnsFromData, - getSpecColumns, - getStats, - inferAll - }, Symbol.toStringTag, { value: "Module" })); - const GL_ORDINAL = "GL_ORDINAL"; - const constants$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - ColorScaleNone, - FieldNames, - GL_ORDINAL, - ScaleNames, - SignalNames - }, Symbol.toStringTag, { value: "Module" })); - function isSearchExpressionGroup(search) { - if (!search) { - return false; - } - return !!search.expressions; - } - function createGroupFromExpression(input) { - const output2 = { - expressions: [input] - }; - return output2; - } - function ensureSearchExpressionGroupArray(search) { - if (Array.isArray(search)) { - return [...search]; - } else if (isSearchExpressionGroup(search)) { - return [search]; - } else { - return [createGroupFromExpression(search)]; - } - } - const expressionKeys = Object.keys({ - clause: null, - name: null, - operator: null, - value: null - }); - function compareExpression(a2, b2) { - if (a2 && b2) { - for (let k = 0; k < expressionKeys.length; k++) { - const key2 = expressionKeys[k]; - if (a2[key2] != b2[key2]) - return false; - } - } else { - return !a2 && !b2; - } - return true; - } - const groupKeys = Object.keys({ - clause: null - }); - function compareGroup$1(a2, b2) { - for (let k = 0; k < groupKeys.length; k++) { - const key2 = groupKeys[k]; - if (a2[key2] != b2[key2]) - return false; - } - if (!a2.expressions && !b2.expressions) - return true; - if (!a2.expressions || !b2.expressions) - return false; - if (a2.expressions.length != b2.expressions.length) - return false; - for (let i = 0; i < a2.expressions.length; i++) { - if (!compareExpression(a2.expressions[i], b2.expressions[i])) - return false; - } - return true; - } - function compare$4(a2, b2) { - if (a2 == b2) - return true; - if (!a2 || !b2) - return false; - const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); - const [arrA, arrB] = arrs; - if (arrA.length != arrB.length) - return false; - for (let i = 0; i < arrA.length; i++) { - if (!compareGroup$1(arrA[i], arrB[i])) - return false; - } - return true; - } - function startsWith(whole, part) { - if (!part) - return true; - const arrs = [whole, part].map(ensureSearchExpressionGroupArray); - const [wholeArray, partArray] = arrs; - if (partArray.length > wholeArray.length) - return false; - for (let i = 0; i < partArray.length; i++) { - if (!compareGroup$1(wholeArray[i], partArray[i])) - return false; - } - return true; - } - function valueToBoolean(value2) { - if (typeof value2 === "string") { - switch (value2.toLowerCase()) { - case "true": - return true; - case "false": - return false; - } - } - return !!value2; - } - function valueToString(value2) { - if (value2 == null) { - return ""; - } - switch (typeof value2) { - case "string": - return value2; - case "boolean": - case "number": - return value2.toString(); - } - return ""; - } - function isStringOperation(ex) { - switch (ex.operator) { - case "contains": - case "!contains": - case "starts": - case "!starts": - return true; - } - return false; - } - function isnullorEmpty(value2) { - if (value2 == null) - return true; - if (typeof value2 === "string" && value2.length === 0) - return true; - return false; - } - class Exec { - constructor(search, columns) { - this.columns = columns; - this.groups = ensureSearchExpressionGroupArray(search).map((g) => { - const expressions = g.expressions.filter(Boolean); - expressions.forEach((ex) => { - ex.column = this.getColumn(ex.name); - ex.valueBool = valueToBoolean(ex.value); - ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); - ex.stringOperation = isStringOperation(ex); - }); - const group2 = Object.assign(Object.assign({}, g), { expressions }); - return group2; - }); - } - getColumn(name) { - for (let i = 0; i < this.columns.length; i++) { - if (this.columns[i].name == name) { - return this.columns[i]; - } - } - } - runExpressionOnColumn(datum2, ex) { - const actualDataValue = datum2[ex.name]; - if (ex.operator === "isnullorEmpty") { - return isnullorEmpty(actualDataValue); - } else if (ex.operator === "!isnullorEmpty") { - return !isnullorEmpty(actualDataValue); - } - let dataValue = actualDataValue; - let expressionValue = ex.value; - if (ex.column) { - if (ex.column.type === "string" || ex.stringOperation) { - dataValue = valueToString(actualDataValue).toLocaleLowerCase(); - expressionValue = ex.valueLow; - } else if (ex.column.type === "boolean") { - dataValue = valueToBoolean(actualDataValue); - expressionValue = ex.valueBool; - } else if (ex.column.quantitative) { - dataValue = +actualDataValue; - expressionValue = +ex.value; - } - } - switch (ex.operator) { - case "!=": - return dataValue != expressionValue; - case "<": - return dataValue < expressionValue; - case "<=": - return dataValue <= expressionValue; - case "==": - return dataValue == expressionValue; - case ">": - return dataValue > expressionValue; - case ">=": - return dataValue >= expressionValue; - case "contains": - return dataValue.indexOf(expressionValue) >= 0; - case "!contains": - return dataValue.indexOf(expressionValue) < 0; - case "starts": - return dataValue.indexOf(expressionValue) == 0; - case "!starts": - return dataValue.indexOf(expressionValue) !== 0; - } - } - runExpression(datum2, ex) { - if (ex.name == null) { - const group2 = { - expressions: this.columns.map((column, i) => { - const ex2 = Object.assign(Object.assign({}, ex), { column, name: column.name }); - if (i) { - ex2.clause = "||"; - } - return ex2; - }) - }; - return this.runGroup(datum2, group2); - } else { - return this.runExpressionOnColumn(datum2, ex); - } - } - runGroup(datum2, group2) { - let accumulator = this.runExpression(datum2, group2.expressions[0]); - for (let i = 1; i < group2.expressions.length; i++) { - const ex = group2.expressions[i]; - switch (ex.clause) { - case "&&": - accumulator = accumulator && this.runExpression(datum2, ex); - break; - case "||": - accumulator = accumulator || this.runExpression(datum2, ex); - break; - } - } - return accumulator; - } - run(datum2) { - let accumulator = this.runGroup(datum2, this.groups[0]); - for (let i = 1; i < this.groups.length; i++) { - const group2 = this.groups[i]; - switch (group2.clause) { - case "&&": - accumulator = accumulator && this.runGroup(datum2, group2); - break; - case "||": - accumulator = accumulator || this.runGroup(datum2, group2); - break; - } - } - return accumulator; - } - } - function invertSearchExpressionGroup(input) { - const output2 = { - expressions: input.expressions.map(invertSearchExpression) - }; - if (input.clause) { - output2.clause = invertedClauses[input.clause]; - } - return output2; - } - const invertedOperators = { - "!=": "==", - "==": "!=", - "<": ">=", - ">=": "<", - "<=": ">", - ">": "<=", - "!contains": "contains", - "contains": "!contains", - "!isnullorEmpty": "isnullorEmpty", - "isnullorEmpty": "!isnullorEmpty", - "!starts": "starts", - "starts": "!starts" - }; - const invertedClauses = { - "&&": "||", - "||": "&&" - }; - function invertSearchExpression(input) { - const operator2 = invertedOperators[input.operator]; - const output2 = Object.assign(Object.assign({}, input), { operator: operator2 }); - if (input.clause) { - output2.clause = invertedClauses[input.clause]; - } - return output2; - } - function invert$2(search) { - if (Array.isArray(search)) { - return search.map(invertSearchExpressionGroup); - } else if (isSearchExpressionGroup(search)) { - return invertSearchExpressionGroup(search); - } else { - return invertSearchExpression(search); - } - } - function narrow(a2, b2) { - if (!a2) { - return b2; - } - const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); - const [arrA, arrB] = arrs; - arrB[0].clause = "&&"; - return arrA.concat(arrB); - } - const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - Exec, - compare: compare$4, - compareExpression, - compareGroup: compareGroup$1, - createGroupFromExpression, - ensureSearchExpressionGroupArray, - invert: invert$2, - isSearchExpressionGroup, - narrow, - startsWith - }, Symbol.toStringTag, { value: "Module" })); - const types$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null - }, Symbol.toStringTag, { value: "Module" })); - const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; - function decamelize(str, separator = "-") { - return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2").toLowerCase(); - } - function createElement(tag, attrs, ...children2) { - if (typeof tag === "function") { - const fn2 = tag; - let props = attrs; - if (props === null || props === void 0) { - props = { children: children2 }; - } else { - props.children = children2; - } - return fn2(props); - } else { - const ns = tag === "svg" ? SVG_NAMESPACE : null; - const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); - const map2 = attrs; - let ref2; - for (let name in map2) { - if (name && map2.hasOwnProperty(name)) { - let value2 = map2[name]; - if (name === "className" && value2 !== void 0) { - setAttribute$1(el, ns, "class", value2.toString()); - } else if (name === "disabled" && !value2) ; - else if (value2 === null || value2 === void 0) { - continue; - } else if (value2 === true) { - setAttribute$1(el, ns, name, name); - } else if (typeof value2 === "function") { - if (name === "ref") { - ref2 = value2; - } else { - el[name.toLowerCase()] = value2; - } - } else if (typeof value2 === "object") { - setAttribute$1(el, ns, name, flatten$1(value2)); - } else { - setAttribute$1(el, ns, name, value2.toString()); - } - } - } - if (children2 && children2.length > 0) { - appendChildren(el, children2); - } - if (ref2) { - ref2(el); - } - return el; - } - } - function setAttribute$1(el, ns, name, value2) { - if (ns) { - el.setAttributeNS(null, name, value2); - } else { - el.setAttribute(name, value2); - } - } - function flatten$1(o) { - const arr = []; - for (let prop in o) - arr.push(`${decamelize(prop, "-")}:${o[prop]}`); - return arr.join(";"); - } - function isInsideForeignObject(element2) { - let current = element2; - while (current) { - if (current.tagName.toLowerCase() === "foreignobject") { - return true; - } - current = current.parentElement; - } - return false; - } - function recreateWithSvgNamespace(element2) { - const svgElement = document.createElementNS(SVG_NAMESPACE, element2.tagName.toLowerCase()); - for (let i = 0; i < element2.attributes.length; i++) { - const attr2 = element2.attributes[i]; - svgElement.setAttributeNS(null, attr2.name, attr2.value); - } - const eventProperties = [ - "onclick", - "onmousedown", - "onmouseup", - "onmouseover", - "onmouseout", - "onmousemove", - "onkeydown", - "onkeyup", - "onkeypress", - "onfocus", - "onblur" - ]; - for (const prop of eventProperties) { - if (element2[prop]) { - svgElement[prop] = element2[prop]; - } - } - for (let i = 0; i < element2.childNodes.length; i++) { - const child = element2.childNodes[i]; - if (child.nodeType === Node.ELEMENT_NODE) { - svgElement.appendChild(recreateWithSvgNamespace(child)); - } else { - svgElement.appendChild(child.cloneNode(true)); - } - } - return svgElement; - } - function addChild(parentElement, child) { - if (child === null || child === void 0 || typeof child === "boolean") { - return; - } else if (Array.isArray(child)) { - appendChildren(parentElement, child); - } else if (isElement(child)) { - const childEl = child; - if (parentElement.namespaceURI === SVG_NAMESPACE && childEl.namespaceURI !== SVG_NAMESPACE && childEl.tagName.toLowerCase() !== "foreignobject" && !isInsideForeignObject(parentElement)) { - const recreated = recreateWithSvgNamespace(childEl); - parentElement.appendChild(recreated); - } else { - parentElement.appendChild(childEl); - } - } else { - parentElement.appendChild(document.createTextNode(child.toString())); - } - } - function appendChildren(parentElement, children2) { - children2.forEach((child) => addChild(parentElement, child)); - } - function isElement(el) { - return !!el.nodeType; - } - function mount(element2, container) { - container.innerHTML = ""; - if (element2) { - addChild(container, element2); - } - } - function findElementByChildPositions(childPositions, container) { - let element2 = container || document.body; - let childPosition; - while (element2 && childPositions.length) { - childPosition = childPositions.shift(); - element2 = element2.children.item(childPosition); - } - if (element2) { - return element2; - } - } - function focusActiveElement(element2, activeElementInfo) { - element2.focus(); - element2.scrollTop = activeElementInfo.scrollTop; - const input = element2; - if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) { - input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); - } - } - function setActiveElement(activeElementInfo, container) { - if (activeElementInfo) { - const element2 = findElementByChildPositions(activeElementInfo.childPositions, container); - if (element2) { - focusActiveElement(element2, activeElementInfo); - } - } - } - function getActiveElementInfo(container) { - let element2 = document.activeElement; - const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element2; - const activeElementInfo = { - childPositions: [], - scrollTop, - selectionDirection, - selectionEnd, - selectionStart - }; - while (element2 && element2 !== document.body && element2 !== container) { - activeElementInfo.childPositions.unshift(getChildPosition(element2)); - element2 = element2.parentElement; - } - if ((element2 === document.body || element2 === container) && activeElementInfo.childPositions.length) - return activeElementInfo; - } - function getChildPosition(element2) { - let childPosition = 0; - while (element2 = element2.previousElementSibling) - childPosition++; - return childPosition; - } - const KeyCodes$2 = { - ENTER: "Enter" - }; - const Table$1 = (props) => { - return createElement( - "table", - { className: props.className }, - props.children, - props.rows.map((row, i) => createElement("tr", { className: props.rowClassName || "", onClick: (e) => props.onRowClick && props.onRowClick(e, i), tabIndex: props.onRowClick ? 0 : -1, onKeyUp: (e) => { - if (e.key === KeyCodes$2.ENTER && props.onRowClick) { - props.onRowClick(e, i); - } - } }, row.cells.map((cell2, i2) => createElement("td", { className: cell2.className || "", title: cell2.title || "" }, cell2.content)))) - ); - }; - const controls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - Table: Table$1 - }, Symbol.toStringTag, { value: "Module" })); - var EPSILON$3 = 1e-6; - var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; - function setMatrixArrayType(type2) { - ARRAY_TYPE = type2; - } - function create$8() { - var out = new ARRAY_TYPE(9); - if (ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; - } - out[0] = 1; - out[4] = 1; - out[8] = 1; - return out; - } - function fromMat4(out, a2) { - out[0] = a2[0]; - out[1] = a2[1]; - out[2] = a2[2]; - out[3] = a2[4]; - out[4] = a2[5]; - out[5] = a2[6]; - out[6] = a2[8]; - out[7] = a2[9]; - out[8] = a2[10]; - return out; - } - function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { - var out = new ARRAY_TYPE(9); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; - return out; - } - function fromQuat$1(out, q) { - var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; - var x22 = x2 + x2; - var y22 = y2 + y2; - var z22 = z2 + z2; - var xx = x2 * x22; - var yx = y2 * x22; - var yy = y2 * y22; - var zx = z2 * x22; - var zy = z2 * y22; - var zz = z2 * z22; - var wx = w2 * x22; - var wy = w2 * y22; - var wz = w2 * z22; - out[0] = 1 - yy - zz; - out[3] = yx - wz; - out[6] = zx + wy; - out[1] = yx + wz; - out[4] = 1 - xx - zz; - out[7] = zy - wx; - out[2] = zx - wy; - out[5] = zy + wx; - out[8] = 1 - xx - yy; - return out; - } - function create$7() { - var out = new ARRAY_TYPE(16); - if (ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - } - out[0] = 1; - out[5] = 1; - out[10] = 1; - out[15] = 1; - return out; - } - function copy$7(out, a2) { - out[0] = a2[0]; - out[1] = a2[1]; - out[2] = a2[2]; - out[3] = a2[3]; - out[4] = a2[4]; - out[5] = a2[5]; - out[6] = a2[6]; - out[7] = a2[7]; - out[8] = a2[8]; - out[9] = a2[9]; - out[10] = a2[10]; - out[11] = a2[11]; - out[12] = a2[12]; - out[13] = a2[13]; - out[14] = a2[14]; - out[15] = a2[15]; - return out; - } - function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - var out = new ARRAY_TYPE(16); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; - } - function identity$8(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; - } - function invert$1(out, a2) { - var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; - var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; - var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; - var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) { - return null; - } - det = 1 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - return out; - } - function multiply$2(out, a2, b2) { - var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; - var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; - var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; - var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; - var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3]; - out[0] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; - out[1] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; - out[2] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; - out[3] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; - b0 = b2[4]; - b1 = b2[5]; - b22 = b2[6]; - b3 = b2[7]; - out[4] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; - out[5] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; - out[6] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; - out[7] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; - b0 = b2[8]; - b1 = b2[9]; - b22 = b2[10]; - b3 = b2[11]; - out[8] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; - out[9] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; - out[10] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; - out[11] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; - b0 = b2[12]; - b1 = b2[13]; - b22 = b2[14]; - b3 = b2[15]; - out[12] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; - out[13] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; - out[14] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; - out[15] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; - return out; - } - function translate$2(out, a2, v) { - var x2 = v[0], y2 = v[1], z2 = v[2]; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - if (a2 === out) { - out[12] = a2[0] * x2 + a2[4] * y2 + a2[8] * z2 + a2[12]; - out[13] = a2[1] * x2 + a2[5] * y2 + a2[9] * z2 + a2[13]; - out[14] = a2[2] * x2 + a2[6] * y2 + a2[10] * z2 + a2[14]; - out[15] = a2[3] * x2 + a2[7] * y2 + a2[11] * z2 + a2[15]; - } else { - a00 = a2[0]; - a01 = a2[1]; - a02 = a2[2]; - a03 = a2[3]; - a10 = a2[4]; - a11 = a2[5]; - a12 = a2[6]; - a13 = a2[7]; - a20 = a2[8]; - a21 = a2[9]; - a22 = a2[10]; - a23 = a2[11]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a03; - out[4] = a10; - out[5] = a11; - out[6] = a12; - out[7] = a13; - out[8] = a20; - out[9] = a21; - out[10] = a22; - out[11] = a23; - out[12] = a00 * x2 + a10 * y2 + a20 * z2 + a2[12]; - out[13] = a01 * x2 + a11 * y2 + a21 * z2 + a2[13]; - out[14] = a02 * x2 + a12 * y2 + a22 * z2 + a2[14]; - out[15] = a03 * x2 + a13 * y2 + a23 * z2 + a2[15]; - } - return out; - } - function scale$6(out, a2, v) { - var x2 = v[0], y2 = v[1], z2 = v[2]; - out[0] = a2[0] * x2; - out[1] = a2[1] * x2; - out[2] = a2[2] * x2; - out[3] = a2[3] * x2; - out[4] = a2[4] * y2; - out[5] = a2[5] * y2; - out[6] = a2[6] * y2; - out[7] = a2[7] * y2; - out[8] = a2[8] * z2; - out[9] = a2[9] * z2; - out[10] = a2[10] * z2; - out[11] = a2[11] * z2; - out[12] = a2[12]; - out[13] = a2[13]; - out[14] = a2[14]; - out[15] = a2[15]; - return out; - } - function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = v[1]; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = v[2]; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; - } - function fromRotationTranslationScale(out, q, v, s2) { - var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; - var x22 = x2 + x2; - var y22 = y2 + y2; - var z22 = z2 + z2; - var xx = x2 * x22; - var xy = x2 * y22; - var xz = x2 * z22; - var yy = y2 * y22; - var yz = y2 * z22; - var zz = z2 * z22; - var wx = w2 * x22; - var wy = w2 * y22; - var wz = w2 * z22; - var sx = s2[0]; - var sy = s2[1]; - var sz2 = s2[2]; - out[0] = (1 - (yy + zz)) * sx; - out[1] = (xy + wz) * sx; - out[2] = (xz - wy) * sx; - out[3] = 0; - out[4] = (xy - wz) * sy; - out[5] = (1 - (xx + zz)) * sy; - out[6] = (yz + wx) * sy; - out[7] = 0; - out[8] = (xz + wy) * sz2; - out[9] = (yz - wx) * sz2; - out[10] = (1 - (xx + yy)) * sz2; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; - } - function fromRotationTranslationScaleOrigin(out, q, v, s2, o) { - var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; - var x22 = x2 + x2; - var y22 = y2 + y2; - var z22 = z2 + z2; - var xx = x2 * x22; - var xy = x2 * y22; - var xz = x2 * z22; - var yy = y2 * y22; - var yz = y2 * z22; - var zz = z2 * z22; - var wx = w2 * x22; - var wy = w2 * y22; - var wz = w2 * z22; - var sx = s2[0]; - var sy = s2[1]; - var sz2 = s2[2]; - var ox = o[0]; - var oy = o[1]; - var oz = o[2]; - var out0 = (1 - (yy + zz)) * sx; - var out1 = (xy + wz) * sx; - var out2 = (xz - wy) * sx; - var out4 = (xy - wz) * sy; - var out5 = (1 - (xx + zz)) * sy; - var out6 = (yz + wx) * sy; - var out8 = (xz + wy) * sz2; - var out9 = (yz - wx) * sz2; - var out10 = (1 - (xx + yy)) * sz2; - out[0] = out0; - out[1] = out1; - out[2] = out2; - out[3] = 0; - out[4] = out4; - out[5] = out5; - out[6] = out6; - out[7] = 0; - out[8] = out8; - out[9] = out9; - out[10] = out10; - out[11] = 0; - out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); - out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); - out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); - out[15] = 1; - return out; - } - function fromQuat(out, q) { - var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; - var x22 = x2 + x2; - var y22 = y2 + y2; - var z22 = z2 + z2; - var xx = x2 * x22; - var yx = y2 * x22; - var yy = y2 * y22; - var zx = z2 * x22; - var zy = z2 * y22; - var zz = z2 * z22; - var wx = w2 * x22; - var wy = w2 * y22; - var wz = w2 * z22; - out[0] = 1 - yy - zz; - out[1] = yx + wz; - out[2] = zx - wy; - out[3] = 0; - out[4] = yx - wz; - out[5] = 1 - xx - zz; - out[6] = zy + wx; - out[7] = 0; - out[8] = zx + wy; - out[9] = zy - wx; - out[10] = 1 - xx - yy; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; - } - function frustum(out, left, right, bottom, top, near, far) { - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - out[0] = near * 2 * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = near * 2 * tb; - out[6] = 0; - out[7] = 0; - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = far * near * 2 * nf; - out[15] = 0; - return out; - } - function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1 / Math.tan(fovy / 2); - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - var nf = 1 / (near - far); - out[10] = (far + near) * nf; - out[14] = 2 * far * near * nf; - } else { - out[10] = -1; - out[14] = -2 * near; - } - return out; - } - var perspective = perspectiveNO; - function lookAt(out, eye, center, up) { - var x02, x12, x2, y02, y12, y2, z02, z1, z2, len2; - var eyex = eye[0]; - var eyey = eye[1]; - var eyez = eye[2]; - var upx = up[0]; - var upy = up[1]; - var upz = up[2]; - var centerx = center[0]; - var centery = center[1]; - var centerz = center[2]; - if (Math.abs(eyex - centerx) < EPSILON$3 && Math.abs(eyey - centery) < EPSILON$3 && Math.abs(eyez - centerz) < EPSILON$3) { - return identity$8(out); - } - z02 = eyex - centerx; - z1 = eyey - centery; - z2 = eyez - centerz; - len2 = 1 / Math.sqrt(z02 * z02 + z1 * z1 + z2 * z2); - z02 *= len2; - z1 *= len2; - z2 *= len2; - x02 = upy * z2 - upz * z1; - x12 = upz * z02 - upx * z2; - x2 = upx * z1 - upy * z02; - len2 = Math.sqrt(x02 * x02 + x12 * x12 + x2 * x2); - if (!len2) { - x02 = 0; - x12 = 0; - x2 = 0; - } else { - len2 = 1 / len2; - x02 *= len2; - x12 *= len2; - x2 *= len2; - } - y02 = z1 * x2 - z2 * x12; - y12 = z2 * x02 - z02 * x2; - y2 = z02 * x12 - z1 * x02; - len2 = Math.sqrt(y02 * y02 + y12 * y12 + y2 * y2); - if (!len2) { - y02 = 0; - y12 = 0; - y2 = 0; - } else { - len2 = 1 / len2; - y02 *= len2; - y12 *= len2; - y2 *= len2; - } - out[0] = x02; - out[1] = y02; - out[2] = z02; - out[3] = 0; - out[4] = x12; - out[5] = y12; - out[6] = z1; - out[7] = 0; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x02 * eyex + x12 * eyey + x2 * eyez); - out[13] = -(y02 * eyex + y12 * eyey + y2 * eyez); - out[14] = -(z02 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - return out; - } - var mul = multiply$2; - function create$6() { - var out = new ARRAY_TYPE(3); - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - return out; - } - function clone$4(a2) { - var out = new ARRAY_TYPE(3); - out[0] = a2[0]; - out[1] = a2[1]; - out[2] = a2[2]; - return out; - } - function length$1(a2) { - var x2 = a2[0]; - var y2 = a2[1]; - var z2 = a2[2]; - return Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2); - } - function fromValues$3(x2, y2, z2) { - var out = new ARRAY_TYPE(3); - out[0] = x2; - out[1] = y2; - out[2] = z2; - return out; - } - function copy$6(out, a2) { - out[0] = a2[0]; - out[1] = a2[1]; - out[2] = a2[2]; - return out; - } - function set$8(out, x2, y2, z2) { - out[0] = x2; - out[1] = y2; - out[2] = z2; - return out; - } - function add$4(out, a2, b2) { - out[0] = a2[0] + b2[0]; - out[1] = a2[1] + b2[1]; - out[2] = a2[2] + b2[2]; - return out; - } - function subtract(out, a2, b2) { - out[0] = a2[0] - b2[0]; - out[1] = a2[1] - b2[1]; - out[2] = a2[2] - b2[2]; - return out; - } - function multiply$1(out, a2, b2) { - out[0] = a2[0] * b2[0]; - out[1] = a2[1] * b2[1]; - out[2] = a2[2] * b2[2]; - return out; - } - function min$3(out, a2, b2) { - out[0] = Math.min(a2[0], b2[0]); - out[1] = Math.min(a2[1], b2[1]); - out[2] = Math.min(a2[2], b2[2]); - return out; - } - function max$3(out, a2, b2) { - out[0] = Math.max(a2[0], b2[0]); - out[1] = Math.max(a2[1], b2[1]); - out[2] = Math.max(a2[2], b2[2]); - return out; - } - function scale$5(out, a2, b2) { - out[0] = a2[0] * b2; - out[1] = a2[1] * b2; - out[2] = a2[2] * b2; - return out; - } - function scaleAndAdd(out, a2, b2, scale2) { - out[0] = a2[0] + b2[0] * scale2; - out[1] = a2[1] + b2[1] * scale2; - out[2] = a2[2] + b2[2] * scale2; - return out; - } - function distance(a2, b2) { - var x2 = b2[0] - a2[0]; - var y2 = b2[1] - a2[1]; - var z2 = b2[2] - a2[2]; - return Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2); - } - function squaredDistance(a2, b2) { - var x2 = b2[0] - a2[0]; - var y2 = b2[1] - a2[1]; - var z2 = b2[2] - a2[2]; - return x2 * x2 + y2 * y2 + z2 * z2; - } - function squaredLength(a2) { - var x2 = a2[0]; - var y2 = a2[1]; - var z2 = a2[2]; - return x2 * x2 + y2 * y2 + z2 * z2; - } - function negate(out, a2) { - out[0] = -a2[0]; - out[1] = -a2[1]; - out[2] = -a2[2]; - return out; - } - function normalize$5(out, a2) { - var x2 = a2[0]; - var y2 = a2[1]; - var z2 = a2[2]; - var len2 = x2 * x2 + y2 * y2 + z2 * z2; - if (len2 > 0) { - len2 = 1 / Math.sqrt(len2); - } - out[0] = a2[0] * len2; - out[1] = a2[1] * len2; - out[2] = a2[2] * len2; - return out; - } - function dot$1(a2, b2) { - return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; - } - function cross$1(out, a2, b2) { - var ax = a2[0], ay = a2[1], az = a2[2]; - var bx = b2[0], by = b2[1], bz = b2[2]; - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; - } - function lerp$1(out, a2, b2, t) { - var ax = a2[0]; - var ay = a2[1]; - var az = a2[2]; - out[0] = ax + t * (b2[0] - ax); - out[1] = ay + t * (b2[1] - ay); - out[2] = az + t * (b2[2] - az); - return out; - } - function transformMat4$2(out, a2, m2) { - var x2 = a2[0], y2 = a2[1], z2 = a2[2]; - var w2 = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15]; - w2 = w2 || 1; - out[0] = (m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12]) / w2; - out[1] = (m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13]) / w2; - out[2] = (m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14]) / w2; - return out; - } - function transformMat3(out, a2, m2) { - var x2 = a2[0], y2 = a2[1], z2 = a2[2]; - out[0] = x2 * m2[0] + y2 * m2[3] + z2 * m2[6]; - out[1] = x2 * m2[1] + y2 * m2[4] + z2 * m2[7]; - out[2] = x2 * m2[2] + y2 * m2[5] + z2 * m2[8]; - return out; - } - function transformQuat(out, a2, q) { - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; - var vx = a2[0], vy = a2[1], vz = a2[2]; - var tx2 = qy * vz - qz * vy; - var ty2 = qz * vx - qx * vz; - var tz = qx * vy - qy * vx; - tx2 = tx2 + tx2; - ty2 = ty2 + ty2; - tz = tz + tz; - out[0] = vx + qw * tx2 + qy * tz - qz * ty2; - out[1] = vy + qw * ty2 + qz * tx2 - qx * tz; - out[2] = vz + qw * tz + qx * ty2 - qy * tx2; - return out; - } - function exactEquals$1(a2, b2) { - return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2]; - } - function equals$2(a2, b2) { - var a0 = a2[0], a1 = a2[1], a22 = a2[2]; - var b0 = b2[0], b1 = b2[1], b22 = b2[2]; - return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b22) <= EPSILON$3 * Math.max(1, Math.abs(a22), Math.abs(b22)); - } - var len = length$1; - (function() { - var vec2 = create$6(); - return function(a2, stride, offset2, count2, fn2, arg) { - var i, l; - if (!stride) { - stride = 3; - } - if (!offset2) { - offset2 = 0; - } - if (count2) { - l = Math.min(count2 * stride + offset2, a2.length); - } else { - l = a2.length; - } - for (i = offset2; i < l; i += stride) { - vec2[0] = a2[i]; - vec2[1] = a2[i + 1]; - vec2[2] = a2[i + 2]; - fn2(vec2, vec2, arg); - a2[i] = vec2[0]; - a2[i + 1] = vec2[1]; - a2[i + 2] = vec2[2]; - } - return a2; - }; - })(); - function create$5() { - var out = new ARRAY_TYPE(4); - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - } - return out; - } - function clone$3(a2) { - var out = new ARRAY_TYPE(4); - out[0] = a2[0]; - out[1] = a2[1]; - out[2] = a2[2]; - out[3] = a2[3]; - return out; - } - function fromValues$2(x2, y2, z2, w2) { - var out = new ARRAY_TYPE(4); - out[0] = x2; - out[1] = y2; - out[2] = z2; - out[3] = w2; - return out; - } - function copy$5(out, a2) { - out[0] = a2[0]; - out[1] = a2[1]; - out[2] = a2[2]; - out[3] = a2[3]; - return out; - } - function set$7(out, x2, y2, z2, w2) { - out[0] = x2; - out[1] = y2; - out[2] = z2; - out[3] = w2; - return out; - } - function normalize$4(out, a2) { - var x2 = a2[0]; - var y2 = a2[1]; - var z2 = a2[2]; - var w2 = a2[3]; - var len2 = x2 * x2 + y2 * y2 + z2 * z2 + w2 * w2; - if (len2 > 0) { - len2 = 1 / Math.sqrt(len2); - } - out[0] = x2 * len2; - out[1] = y2 * len2; - out[2] = z2 * len2; - out[3] = w2 * len2; - return out; - } - function dot(a2, b2) { - return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2] + a2[3] * b2[3]; - } - function transformMat4$1(out, a2, m2) { - var x2 = a2[0], y2 = a2[1], z2 = a2[2], w2 = a2[3]; - out[0] = m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12] * w2; - out[1] = m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13] * w2; - out[2] = m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14] * w2; - out[3] = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15] * w2; - return out; - } - function exactEquals(a2, b2) { - return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2] && a2[3] === b2[3]; - } - (function() { - var vec2 = create$5(); - return function(a2, stride, offset2, count2, fn2, arg) { - var i, l; - if (!stride) { - stride = 4; - } - if (!offset2) { - offset2 = 0; - } - if (count2) { - l = Math.min(count2 * stride + offset2, a2.length); - } else { - l = a2.length; - } - for (i = offset2; i < l; i += stride) { - vec2[0] = a2[i]; - vec2[1] = a2[i + 1]; - vec2[2] = a2[i + 2]; - vec2[3] = a2[i + 3]; - fn2(vec2, vec2, arg); - a2[i] = vec2[0]; - a2[i + 1] = vec2[1]; - a2[i + 2] = vec2[2]; - a2[i + 3] = vec2[3]; - } - return a2; - }; - })(); - function create$4() { - var out = new ARRAY_TYPE(4); - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - out[3] = 1; - return out; - } - function setAxisAngle(out, axis, rad) { - rad = rad * 0.5; - var s2 = Math.sin(rad); - out[0] = s2 * axis[0]; - out[1] = s2 * axis[1]; - out[2] = s2 * axis[2]; - out[3] = Math.cos(rad); - return out; - } - function multiply(out, a2, b2) { - var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; - var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; - out[0] = ax * bw + aw * bx + ay * bz - az * by; - out[1] = ay * bw + aw * by + az * bx - ax * bz; - out[2] = az * bw + aw * bz + ax * by - ay * bx; - out[3] = aw * bw - ax * bx - ay * by - az * bz; - return out; - } - function rotateX(out, a2, rad) { - rad *= 0.5; - var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; - var bx = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + aw * bx; - out[1] = ay * bw + az * bx; - out[2] = az * bw - ay * bx; - out[3] = aw * bw - ax * bx; - return out; - } - function rotateY(out, a2, rad) { - rad *= 0.5; - var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; - var by = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw - az * by; - out[1] = ay * bw + aw * by; - out[2] = az * bw + ax * by; - out[3] = aw * bw - ay * by; - return out; - } - function slerp(out, a2, b2, t) { - var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; - var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; - var omega, cosom, sinom, scale0, scale1; - cosom = ax * bx + ay * by + az * bz + aw * bw; - if (cosom < 0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } - if (1 - cosom > EPSILON$3) { - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } else { - scale0 = 1 - t; - scale1 = t; - } - out[0] = scale0 * ax + scale1 * bx; - out[1] = scale0 * ay + scale1 * by; - out[2] = scale0 * az + scale1 * bz; - out[3] = scale0 * aw + scale1 * bw; - return out; - } - function conjugate(out, a2) { - out[0] = -a2[0]; - out[1] = -a2[1]; - out[2] = -a2[2]; - out[3] = a2[3]; - return out; - } - function fromMat3(out, m2) { - var fTrace = m2[0] + m2[4] + m2[8]; - var fRoot; - if (fTrace > 0) { - fRoot = Math.sqrt(fTrace + 1); - out[3] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[0] = (m2[5] - m2[7]) * fRoot; - out[1] = (m2[6] - m2[2]) * fRoot; - out[2] = (m2[1] - m2[3]) * fRoot; - } else { - var i = 0; - if (m2[4] > m2[0]) i = 1; - if (m2[8] > m2[i * 3 + i]) i = 2; - var j = (i + 1) % 3; - var k = (i + 2) % 3; - fRoot = Math.sqrt(m2[i * 3 + i] - m2[j * 3 + j] - m2[k * 3 + k] + 1); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m2[j * 3 + k] - m2[k * 3 + j]) * fRoot; - out[j] = (m2[j * 3 + i] + m2[i * 3 + j]) * fRoot; - out[k] = (m2[k * 3 + i] + m2[i * 3 + k]) * fRoot; - } - return out; - } - var clone$2 = clone$3; - var fromValues$1 = fromValues$2; - var copy$4 = copy$5; - var set$6 = set$7; - var normalize$3 = normalize$4; - function equals$1(a2, b2) { - return Math.abs(dot(a2, b2)) >= 1 - EPSILON$3; - } - var rotationTo = (function() { - var tmpvec3 = create$6(); - var xUnitVec3 = fromValues$3(1, 0, 0); - var yUnitVec3 = fromValues$3(0, 1, 0); - return function(out, a2, b2) { - var dot2 = dot$1(a2, b2); - if (dot2 < -0.999999) { - cross$1(tmpvec3, xUnitVec3, a2); - if (len(tmpvec3) < 1e-6) cross$1(tmpvec3, yUnitVec3, a2); - normalize$5(tmpvec3, tmpvec3); - setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot2 > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; - } else { - cross$1(tmpvec3, a2, b2); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot2; - return normalize$3(out, out); - } - }; - })(); - (function() { - var temp1 = create$4(); - var temp2 = create$4(); - return function(out, a2, b2, c2, d2, t) { - slerp(temp1, a2, d2, t); - slerp(temp2, b2, c2, t); - slerp(out, temp1, temp2, 2 * t * (1 - t)); - return out; - }; - })(); - (function() { - var matr = create$8(); - return function(out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - return normalize$3(out, fromMat3(out, matr)); - }; - })(); - function create$3() { - var out = new ARRAY_TYPE(2); - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - } - return out; - } - function clone$1(a2) { - var out = new ARRAY_TYPE(2); - out[0] = a2[0]; - out[1] = a2[1]; - return out; - } - function fromValues(x2, y2) { - var out = new ARRAY_TYPE(2); - out[0] = x2; - out[1] = y2; - return out; - } - function copy$3(out, a2) { - out[0] = a2[0]; - out[1] = a2[1]; - return out; - } - function set$5(out, x2, y2) { - out[0] = x2; - out[1] = y2; - return out; - } - function transformMat4(out, a2, m2) { - var x2 = a2[0]; - var y2 = a2[1]; - out[0] = m2[0] * x2 + m2[4] * y2 + m2[12]; - out[1] = m2[1] * x2 + m2[5] * y2 + m2[13]; - return out; - } - function equals(a2, b2) { - var a0 = a2[0], a1 = a2[1]; - var b0 = b2[0], b1 = b2[1]; - return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)); - } - (function() { - var vec2 = create$3(); - return function(a2, stride, offset2, count2, fn2, arg) { - var i, l; - if (!stride) { - stride = 2; - } - if (!offset2) { - offset2 = 0; - } - if (count2) { - l = Math.min(count2 * stride + offset2, a2.length); - } else { - l = a2.length; - } - for (i = offset2; i < l; i += stride) { - vec2[0] = a2[i]; - vec2[1] = a2[i + 1]; - fn2(vec2, vec2, arg); - a2[i] = vec2[0]; - a2[i + 1] = vec2[1]; - } - return a2; - }; - })(); - let Constants$1 = class Constants { - }; - Constants$1.TWO_PI = 6.283185307179586; - Constants$1.PI = 3.141592653589793; - Constants$1.PI_OVER_TWO = 1.5707963267948966; - Constants$1.PI_OVER_THREE = 1.0471975511965976; - Constants$1.PI_OVER_FOUR = 0.7853981633974483; - Constants$1.PI_OVER_SIX = 0.5235987755982988; - Constants$1.LOG_2 = 0.6931471805599453; - Constants$1.RADIANS_PER_DEGREE = 0.017453292519943295; - Constants$1.DEGREES_PER_RADIAN = 57.29577951308232; - Constants$1.ROOT_TWO = 1.4142135623730951; - Constants$1.ROOT_TWO_OVER_TWO = 0.7071067811865476; - Constants$1.ROOT_THREE = 1.7320508075688772; - Constants$1.ROOT_THREE_OVER_TWO = 0.8660254037844386; - Constants$1.ROOT_THREE_OVER_THREE = 0.5773502691896257; - Constants$1.VECTOR2_ZERO = fromValues(0, 0); - Constants$1.VECTOR2_ONE = fromValues(1, 1); - Constants$1.VECTOR2_UNITX = fromValues(1, 0); - Constants$1.VECTOR2_UNITY = fromValues(0, 1); - Constants$1.VECTOR3_ZERO = fromValues$3(0, 0, 0); - Constants$1.VECTOR3_ONE = fromValues$3(1, 1, 1); - Constants$1.VECTOR3_UNITX = fromValues$3(1, 0, 0); - Constants$1.VECTOR3_UNITY = fromValues$3(0, 1, 0); - Constants$1.VECTOR3_UNITZ = fromValues$3(0, 0, 1); - Constants$1.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); - Constants$1.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); - Constants$1.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); - Constants$1.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); - Constants$1.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); - Constants$1.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); - Constants$1.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); - Constants$1.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); - Constants$1.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); - Constants$1.MAT3_IDENTITY = create$8(); - Constants$1.MAT4_IDENTITY = create$7(); - Constants$1.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - Constants$1.QUAT_IDENTITY = create$4(); - Constants$1.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants$1.ROOT_TWO_OVER_TWO, 0, 0, Constants$1.ROOT_TWO_OVER_TWO); - Constants$1.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants$1.ROOT_TWO_OVER_TWO, 0, 0, Constants$1.ROOT_TWO_OVER_TWO); - Constants$1.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO); - Constants$1.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO); - Constants$1.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO); - Constants$1.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO); - Constants$1.MILLISECONDS_PER_DAY = 864e5; - class MathHelper { - static simpleLinearRegression(points2) { - const n = points2.length; - let sumX = 0; - let sumY = 0; - let sumXY = 0; - let sumXX = 0; - for (let i = 0; i < n; i++) { - sumX += points2[i].x; - sumY += points2[i].y; - sumXY += points2[i].x * points2[i].y; - sumXX += points2[i].x * points2[i].x; - } - const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); - const yIntercept = (sumY - slope * sumX) / n; - return { slope, yIntercept }; - } - static clamp(value2, min2, max2) { - return Math.max(Math.min(value2, max2), min2); - } - static lerp(value1, value2, amount) { - return value1 + (value2 - value1) * amount; - } - static normalize(value2, min2, max2, from = 0, to = 1) { - return max2 - min2 == 0 ? 0 : Math.max(Math.min((to - from) * (value2 - min2) / (max2 - min2) + from, to), from); - } - static splitExponent(value2, result) { - let exponent2 = Math.round(Math.log10(Math.abs(value2))); - let coefficient = value2 / Math.pow(10, exponent2); - if (coefficient < 1) { - coefficient *= 10; - exponent2--; - } - result[0] = coefficient; - result[1] = exponent2; - } - static combineExponent(mantissa, exponent2) { - return mantissa * Math.pow(10, exponent2); - } - static isPowerOf2(value2) { - return (value2 & value2 - 1) == 0; - } - } - class PseudoRandom { - constructor(seed) { - this._seed = seed % 2147483647; - if (this._seed <= 0) - this._seed += 2147483646; - } - next() { - return this._seed = this._seed * 16807 % 2147483647; - } - nextFloat() { - return (this.next() - 1) / 2147483646; - } - nextInteger(min2, max2) { - return Math.floor(this.nextFloat() * (max2 - min2 + 1) + min2); - } - } - class AngleHelper { - static degreesToRadians(degrees2) { - return degrees2 * Constants$1.RADIANS_PER_DEGREE; - } - static radiansToDegrees(radians2) { - return radians2 * Constants$1.DEGREES_PER_RADIAN; - } - static wrapAngle(angle2) { - if (angle2 > Constants$1.PI) - angle2 = angle2 - Constants$1.TWO_PI; - else if (angle2 < -Constants$1.PI) - angle2 += Constants$1.TWO_PI; - return angle2; - } - static sphericalToCartesian(altitude, longitude2, latitude, result) { - latitude = AngleHelper.degreesToRadians(latitude); - longitude2 = AngleHelper.degreesToRadians(longitude2); - const scale2 = Math.cos(latitude); - result[0] = altitude * scale2 * Math.sin(longitude2); - result[1] = altitude * Math.sin(latitude); - result[2] = altitude * scale2 * Math.cos(longitude2); - } - static cartesianToSpherical(x2, y2, z2, result) { - result[0] = Math.atan2(x2, z2); - result[1] = Math.asin(y2); - } - static angleBetweenVectors(from, to) { - if (exactEquals$1(from, to)) { - return 0; - } else { - const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); - return Math.acos(dot2); - } - } - static signedAngleBetweenVectors(from, to, up) { - if (exactEquals$1(from, to)) { - return 0; - } else { - const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); - let angle2 = Math.acos(dot2); - cross$1(AngleHelper._vec3, from, to); - if (dot$1(AngleHelper._vec3, up) < 0) { - angle2 = -angle2; - } - return angle2; - } - } - } - AngleHelper._vec3 = create$6(); - class CameraBase { - getView(view) { - this.getPosition(view.position); - } - setView(view, isSmooth) { - this.setPosition(view.position, isSmooth); - } - lerpView(from, to, time2) { - lerp$1(this._vec3, from.position, to.position, time2); - this.setPosition(this._vec3, false); - } - get vMatrices() { - return this._vMatrices; - } - get inverseVMatrices() { - return this._inverseVMatrices; - } - get mvMatrices() { - return this._mvMatrices; - } - get pMatrices() { - return this._pMatrices; - } - get inversePMatrices() { - return this._inversePMatrices; - } - get pickVMatrix() { - return this._pickVMatrix; - } - get rMatrix() { - return this._mat3; - } - getOrbit(value2) { - copy$4(value2, this._orbitRotation); - } - setOrbit(value2, isSmooth) { - copy$4(this._orbitRotation, value2); - if (!isSmooth) { - copy$4(this._smoothedOrbitRotation, value2); - } - } - getPosition(value2) { - copy$6(value2, this._cameraPosition); - } - setPosition(value2, isSmooth) { - copy$6(this._cameraPosition, value2); - if (!isSmooth) { - copy$6(this._smoothedCameraPosition, value2); - } - } - constructor(core) { - this._core = core; - this._vec3 = create$6(); - this._quat = create$4(); - this._mat3 = create$8(); - this._right = create$6(); - this._up = create$6(); - this._forward = create$6(); - this._modelManipulationOrigin = create$6(); - this.modelPosition = create$6(); - this.modelScale = create$6(); - this.modelRotation = create$4(); - this._orbitRotation = create$4(); - this._orbitDirection = create$4(); - this._smoothedOrbitRotation = create$4(); - this._smoothedCameraPosition = create$6(); - this._smoothedCameraRotation = create$4(); - this._cameraPosition = create$6(); - this._cameraRotation = create$4(); - this._combinedPosition = create$6(); - this._combinedRotation = create$4(); - this._leftToRightEye = create$6(); - this._pickVMatrix = create$7(); - this._eyePositions = [create$6(), create$6()]; - this._vMatrices = [create$7(), create$7()]; - this._mvMatrices = [create$7(), create$7()]; - this._pMatrices = [create$7(), create$7()]; - this._inverseVMatrices = [create$7(), create$7()]; - this._inversePMatrices = [create$7(), create$7()]; - } - reset(isSmooth) { - copy$6(this._cameraPosition, Constants$1.VECTOR3_ZERO); - copy$4(this._cameraRotation, Constants$1.QUAT_IDENTITY); - copy$4(this._orbitRotation, Constants$1.QUAT_IDENTITY); - if (!isSmooth) { - this.syncSmooth(); - } - } - update(elapsedTime) { - let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); - lerp$1(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); - amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); - slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); - slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); - const epsilon3 = 1e-6; - let x2; - let y2; - let z2; - let w2; - x2 = this._smoothedCameraPosition[0] - this._cameraPosition[0]; - y2 = this._smoothedCameraPosition[1] - this._cameraPosition[1]; - z2 = this._smoothedCameraPosition[2] - this._cameraPosition[2]; - if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3) { - copy$6(this._smoothedCameraPosition, this._cameraPosition); - } - x2 = this._smoothedCameraRotation[0] - this._cameraRotation[0]; - y2 = this._smoothedCameraRotation[1] - this._cameraRotation[1]; - z2 = this._smoothedCameraRotation[2] - this._cameraRotation[2]; - w2 = this._smoothedCameraRotation[3] - this._cameraRotation[3]; - if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3 && Math.abs(w2) < epsilon3) { - copy$4(this._smoothedCameraRotation, this._cameraRotation); - } - x2 = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; - y2 = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; - z2 = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; - w2 = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; - if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3 && Math.abs(w2) < epsilon3) { - copy$4(this._smoothedOrbitRotation, this._orbitRotation); - } - normalize$3(this._smoothedCameraRotation, this._smoothedCameraRotation); - normalize$3(this._smoothedOrbitRotation, this._smoothedOrbitRotation); - conjugate(this._orbitDirection, this._smoothedOrbitRotation); - transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); - subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); - transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); - add$4(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); - multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); - fromQuat$1(this._mat3, this._combinedRotation); - this._right[0] = this._mat3[0]; - this._right[1] = this._mat3[1]; - this._right[2] = this._mat3[2]; - this._up[0] = this._mat3[3]; - this._up[1] = this._mat3[4]; - this._up[2] = this._mat3[5]; - this._forward[0] = this._mat3[6]; - this._forward[1] = this._mat3[7]; - this._forward[2] = this._mat3[8]; - const view = this._vMatrices[0]; - view[0] = this._right[0]; - view[1] = this._up[0]; - view[2] = this._forward[0]; - view[4] = this._right[1]; - view[5] = this._up[1]; - view[6] = this._forward[1]; - view[8] = this._right[2]; - view[9] = this._up[2]; - view[10] = this._forward[2]; - view[12] = -dot$1(this._right, this._combinedPosition); - view[13] = -dot$1(this._up, this._combinedPosition); - view[14] = -dot$1(this._forward, this._combinedPosition); - const aspectRatio = this.width / this.height; - if (this._core.config.stereoMode == StereoMode.none) { - if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - const left = -aspectRatio * top; - const right = aspectRatio * top; - const width2 = right - left; - const height2 = top - bottom; - const tileWidth = width2 / this._core.config.tilesX; - const tileHeight = height2 / this._core.config.tilesY; - frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); - } else { - perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); - } - multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - invert$1(this._inverseVMatrices[0], this.vMatrices[0]); - invert$1(this._inversePMatrices[0], this.pMatrices[0]); - } else { - cross$1(this._leftToRightEye, this._forward, this._up); - normalize$5(this._leftToRightEye, this._leftToRightEye); - scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); - scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); - this._vMatrices[0][12] += this._core.config.ipd * 0.5; - copy$7(this._vMatrices[1], this._vMatrices[0]); - this._vMatrices[1][12] -= this._core.config.ipd; - const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - let left = -aspectRatio * top + frustumShift; - let right = aspectRatio * top + frustumShift; - frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - left = -aspectRatio * top - frustumShift; - right = aspectRatio * top - frustumShift; - frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); - invert$1(this._inverseVMatrices[0], this._vMatrices[0]); - invert$1(this._inversePMatrices[0], this._pMatrices[0]); - copy$7(this._inverseVMatrices[1], this._inverseVMatrices[0]); - this._inverseVMatrices[1][12] += this._core.config.ipd; - invert$1(this._inversePMatrices[1], this._pMatrices[1]); - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); - } - } - _zoom(direction, distance2) { - scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance2); - } - rotate(translationDelta) { - } - zoom(zoomDelta, x2, y2) { - this.unproject(this._vec3, x2, y2, 1); - normalize$5(this._vec3, this._vec3); - const distance$1 = zoomDelta * distance(this._combinedPosition, this.modelPosition); - transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._zoom(this._vec3, distance$1); - } - _twist(axis, angle2) { - } - twist(angle2, x2, y2) { - } - updatePickVMatrix(x2, y2) { - this.unproject(this._vec3, x2, y2, 1); - lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); - } - syncSmooth() { - copy$6(this._smoothedCameraPosition, this._cameraPosition); - copy$4(this._smoothedCameraRotation, this._cameraRotation); - copy$4(this._smoothedOrbitRotation, this._orbitRotation); - } - updateModelManipulationOrigin(from, to) { - const a2 = create$6(); - const b2 = create$6(); - const c2 = create$6(); - const d2 = create$6(); - transformMat4$2(a2, from, this.modelMMatrix); - transformMat4$2(b2, to, this.modelMMatrix); - subtract(a2, this._cameraPosition, a2); - subtract(b2, this._cameraPosition, b2); - transformQuat(c2, a2, this._orbitDirection); - transformQuat(d2, b2, this._orbitDirection); - subtract(c2, c2, a2); - subtract(d2, d2, b2); - subtract(this._vec3, c2, d2); - transformQuat(this._vec3, this._vec3, this._orbitRotation); - add$4(this._cameraPosition, this._cameraPosition, this._vec3); - add$4(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); - } - unproject(position2, x2, y2, z2) { - set$8(position2, 2 * x2 / this.width - 1, 1 - 2 * y2 / this.height, z2); - transformMat4$2(position2, position2, this._inversePMatrices[0]); - transformMat4$2(position2, position2, this._inverseVMatrices[0]); - } - translate(translationDelta) { - const distance$1 = distance(this.modelPosition, this._combinedPosition); - const height2 = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; - set$8(this._vec3, height2 * translationDelta[0], -height2 * translationDelta[1], 0); - transformQuat(this._vec3, this._vec3, this._combinedRotation); - transformQuat(this._vec3, this._vec3, this._orbitRotation); - subtract(this._cameraPosition, this._cameraPosition, this._vec3); - } - } - class AltAzimuthCamera extends CameraBase { - getView(view) { - super.getView(view); - view.altitude = this.altitude; - view.azimuth = this.azimuth; - view.fov = this._core.config.fov; - } - setView(view, isSmooth) { - super.setView(view, isSmooth); - this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); - this._core.config.fov = view.fov; - } - lerpView(from, to, time2) { - super.lerpView(from, to, time2); - this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time2), MathHelper.lerp(from.azimuth, to.azimuth, time2), false); - this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time2); - } - update(elapsedTime) { - super.update(elapsedTime); - if (this._core.config.isDebugVisible) { - const altitude = AngleHelper.radiansToDegrees(this.altitude); - const azimuth = AngleHelper.radiansToDegrees(this.azimuth); - this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); - this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); - } - } - get altitude() { - transformQuat(this._up, Constants$1.VECTOR3_UNITY, this._combinedRotation); - transformQuat(this._right, Constants$1.VECTOR3_UNITX, this._combinedRotation); - return -AngleHelper.signedAngleBetweenVectors(Constants$1.VECTOR3_UNITY, this._up, this._right); - } - get azimuth() { - transformQuat(this._up, Constants$1.VECTOR3_UNITY, this._combinedRotation); - transformQuat(this._right, Constants$1.VECTOR3_UNITX, this._combinedRotation); - return -AngleHelper.signedAngleBetweenVectors(Constants$1.VECTOR3_UNITX, this._right, this._up); - } - setAltAzimuth(altitude, azimuth, isSmooth) { - setAxisAngle(this._quat, Constants$1.VECTOR3_UNITX, altitude); - multiply(this._orbitRotation, this._quat, Constants$1.QUAT_IDENTITY); - setAxisAngle(this._quat, Constants$1.VECTOR3_UNITY, azimuth); - multiply(this._orbitRotation, this._orbitRotation, this._quat); - if (!isSmooth) { - this.syncSmooth(); - } - } - rotate(translationDelta) { - const length2 = Math.min(this.width, this.height); - let angle2 = translationDelta[1] * Constants$1.PI / length2; - setAxisAngle(this._quat, Constants$1.VECTOR3_UNITX, angle2); - multiply(this._orbitRotation, this._quat, this._orbitRotation); - angle2 = translationDelta[0] * Constants$1.PI / length2; - setAxisAngle(this._quat, Constants$1.VECTOR3_UNITY, angle2); - multiply(this._orbitRotation, this._orbitRotation, this._quat); - } - } - let Config$2 = class Config { - constructor(core) { - this.reset(); - } - reset() { - this.isDebugVisible = false; - this.logLevel = LogLevel.warn; - this.shaderPath = "shaders"; - this.fontPath = "fonts"; - this.modelDistance = 0.5; - this.modelSize = 0.25; - this.stereoMode = StereoMode.none; - this.ipd = 0.06; - this.screenDistance = 0.5; - this.fov = AngleHelper.degreesToRadians(30); - this.nearPlane = 0.01; - this.farPlane = 100; - this.pickWidth = 512; - this.pickHeight = 512; - this.pickHoldDelay = 1e3; - this.pickSelectDelay = 100; - this.resizeMinimumDelay = 250; - this.rotationSmoothing = 0.02; - this.positionSmoothing = 0.02; - this.focusSmoothing = 0.01; - this.scaleSmoothing = 0.02; - this.mouseWheelZoomScale = -2e-3; - this.mouseWheelRotationScale = -2e-3; - this.dragToleranceSquared = 100; - this.manipulatorMinRelativeDistanceSquared = 100; - this.isMultiTouchEnabled = true; - this.isMultiTouchZoomEnabled = true; - this.isMultiTouchTwistEnabled = true; - this.isMultiTouchRotateEnabled = true; - this.isMultiTouchTranslateEnabled = true; - this.multiTouchZoomScale = 1; - this.cameraMinDistance = 0.1; - this.cameraMaxDistance = 10; - this.xrControllerRayColor = fromValues$3(0.5, 0.5, 0.5); - this.xrControllerProfile = "windows-mixed-reality"; - this.xrControllerHandedness = "right"; - this.paletteColor = new Uint8Array([128, 128, 128, 0]); - this.textColor = create$6(); - this.textHoverColor = create$6(); - this.textBorderColor = create$6(); - this.textBorderWidth = 24 / 255; - this.identityRotation = Constants$1.VECTOR3_UNITY; - this.axesTextLabelMaxGlyphs = 32; - this.axesTextColor = create$6(); - this.axesTextBorderColor = create$6(); - this.axesTextHoverColor = create$6(); - this.axesTextLabelMajorSize = 0.03; - this.axesTextLabelMinorSize = 0.02; - this.axesTextTitleMaxGlyphs = 127; - this.axesTextTitleSize = 0.05; - this.axesTextHeadingMaxGlyphs = 128; - this.axesTextHeadingSize = 0.075; - this.axesTextTitleLineHeight = 1.5; - this.axesTextHeadingLineHeight = 1.5; - this.axesTextLabelLineHeight = 1.5; - this.axesGridMajorThickness = 2e-4; - this.axesGridMinorThickness = 1e-4; - this.axesGridZeroThickness = 2e-3; - this.axesGridPickDivisionHeight = 0.025; - this.axesGridBackgroundColor = create$6(); - this.axesGridHighlightColor = create$6(); - this.axesGridMinorColor = create$6(); - this.axesGridMajorColor = create$6(); - this.axesGridZeroColor = create$6(); - this.axesGridDefaultDivisions = 10; - this.keyTitleMaxGlyphs = 64; - this.keyLabelMaxGlyphs = 64; - this.selectionColor = create$6(); - this.hoverColor = create$6(); - this.activeColor = create$6(); - this.highlightMode = HighlightMode.color; - this.lassoThickness = 4; - this.lassoDashWidth = 2; - this.lassoColor = create$6(); - this.minCubifiedTreeMapSlice = 0.01; - this.sdfBuffer = 192; - this.sdfBorder = 0; - this.forceDirectIsEnabled = false; - this.forceDirectAttraction = 1; - this.forceDirectRepulsion = 1; - this.forceDirectGravity = 1; - this.forceDirectInterval = 0.1; - this.forceDirectMaxDistance = 0.1; - this.forceDirectTheta = 1; - this.forceDirectIterationsPerLayout = 1; - this.forceDirectEdgeWeightPower = 1; - this.forceDirectLockX = false; - this.forceDirectLockY = false; - this.forceDirectLockZ = false; - this.transitionDuration = 400; - this.transitionStaggering = 100; - this.transitionView = true; - this.isTransitionPickingEnabled = false; - this.backgroundColor = create$5(); - this.theme = Theme.light; - this.ambientColor = create$6(); - this.renderMode = RenderMode.color; - this.tilesX = 1; - this.tilesY = 1; - this.tileOffsetX = 0; - this.tileOffsetY = 0; - } - get theme() { - return this._theme; - } - set theme(value2) { - if (this._theme != value2) { - this._theme = value2; - switch (value2) { - case Theme.dark: - set$7(this.backgroundColor, 0, 0, 0, 1); - set$8(this.textColor, 0.9, 0.9, 0.9); - set$8(this.textHoverColor, 1, 1, 1); - set$8(this.textBorderColor, 0, 0, 0); - set$8(this.axesTextColor, 0.9, 0.9, 0.9); - set$8(this.axesTextBorderColor, 0, 0, 0); - set$8(this.axesTextHoverColor, 1, 1, 1); - set$8(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); - set$8(this.axesGridHighlightColor, 0.04, 0.04, 0.04); - set$8(this.axesGridMinorColor, 0.05, 0.05, 0.05); - set$8(this.axesGridMajorColor, 0.1, 0.1, 0.1); - set$8(this.axesGridZeroColor, 0.05, 0.1, 0.1); - set$8(this.selectionColor, 1, 1, 0); - set$8(this.hoverColor, 1, 0, 1); - set$8(this.activeColor, 0, 1, 1); - set$8(this.lassoColor, 0.9, 0.9, 0.9); - break; - case Theme.light: - set$7(this.backgroundColor, 1, 1, 1, 1); - set$8(this.textColor, 0, 0, 0); - set$8(this.textHoverColor, 0.1, 0.1, 0.1); - set$8(this.textBorderColor, 1, 1, 1); - set$8(this.axesTextColor, 0, 0, 0); - set$8(this.axesTextBorderColor, 1, 1, 1); - set$8(this.axesTextHoverColor, 0.1, 0.1, 0.1); - set$8(this.axesGridBackgroundColor, 1, 1, 1); - set$8(this.axesGridHighlightColor, 0.925, 0.925, 0.925); - set$8(this.axesGridMinorColor, 0.9, 0.9, 0.9); - set$8(this.axesGridMajorColor, 0.8, 0.8, 0.8); - set$8(this.axesGridZeroColor, 0.7, 0.9, 0.9); - set$8(this.selectionColor, 1, 1, 0); - set$8(this.hoverColor, 1, 0, 1); - set$8(this.activeColor, 0, 1, 1); - set$8(this.lassoColor, 0.1, 0.1, 0.1); - break; - } - if (this.themeChangedCallback) { - this.themeChangedCallback(this._theme); - } - } - } - }; - class DebugText { - get text() { - return this._text; - } - constructor() { - this.clear(); - } - clear() { - this._text = ""; - } - addLine(value2) { - this._text += value2 + "\n"; - } - } - class Fps { - get frameCounter() { - return this._frameCounter; - } - get totalFrames() { - return this._totalFrames; - } - constructor(core) { - this._core = core; - this._totalFrames = 0; - this.reset(); - } - update(elapsedTime) { - this._elapsedTime += elapsedTime; - if (this._elapsedTime > 1e3) { - this._elapsedTime -= 1e3; - this._fps = this._frameCounter; - this._frameCounter = 0; - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`fps ${this._fps}`); - } - } - render() { - this._frameCounter++; - this._totalFrames++; - } - reset() { - this._fps = 0; - this._frameCounter = 0; - this._elapsedTime = 0; - } - } - const PaletteType = { - sequentialsinglehue: "sequentialsinglehue", - sequentialmultihue: "sequentialmultihue", - diverging: "diverging", - qualitative: "qualitative" - }; - class PaletteResources { - constructor() { - this.palettes = { - "blues": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 251, 255, 222, 235, 247, 198, 219, 239, 158, 202, 225, 107, 174, 214, 66, 146, 198, 33, 113, 181, 8, 81, 156, 8, 48, 107]) }, - "greens": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 252, 245, 229, 245, 224, 199, 233, 192, 161, 217, 155, 116, 196, 118, 65, 171, 93, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, - "greys": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 255, 255, 240, 240, 240, 217, 217, 217, 189, 189, 189, 150, 150, 150, 115, 115, 115, 82, 82, 82, 37, 37, 37, 0, 0, 0]) }, - "oranges": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 235, 254, 230, 206, 253, 208, 162, 253, 174, 107, 253, 141, 60, 241, 105, 19, 217, 72, 1, 166, 54, 3, 127, 39, 4]) }, - "purples": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([252, 251, 253, 239, 237, 245, 218, 218, 235, 188, 189, 220, 158, 154, 200, 128, 125, 186, 106, 81, 163, 84, 39, 143, 63, 0, 125]) }, - "reds": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 240, 254, 224, 210, 252, 187, 161, 252, 146, 114, 251, 106, 74, 239, 59, 44, 203, 24, 29, 165, 15, 21, 103, 0, 13]) }, - "viridis": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([72, 37, 117, 65, 68, 135, 53, 96, 141, 42, 120, 142, 33, 145, 141, 34, 168, 132, 67, 191, 113, 122, 209, 81, 188, 223, 39]) }, - "inferno": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([23, 12, 59, 66, 10, 104, 107, 23, 110, 147, 38, 103, 187, 55, 85, 221, 81, 58, 243, 119, 26, 252, 165, 10, 246, 214, 69]) }, - "magma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([21, 14, 55, 59, 15, 112, 101, 26, 128, 140, 41, 129, 182, 55, 122, 222, 73, 104, 247, 111, 92, 254, 159, 109, 254, 206, 145]) }, - "plasma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([66, 3, 157, 106, 0, 168, 144, 13, 164, 177, 42, 144, 203, 71, 121, 225, 100, 98, 242, 131, 76, 252, 166, 54, 252, 206, 37]) }, - "bluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 229, 245, 249, 204, 236, 230, 153, 216, 201, 102, 194, 164, 65, 174, 118, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, - "bluepurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 224, 236, 244, 191, 211, 230, 158, 188, 218, 140, 150, 198, 140, 107, 177, 136, 65, 157, 129, 15, 124, 77, 0, 75]) }, - "greenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 240, 224, 243, 219, 204, 235, 197, 168, 221, 181, 123, 204, 196, 78, 179, 211, 43, 140, 190, 8, 104, 172, 8, 64, 129]) }, - "orangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 236, 254, 232, 200, 253, 212, 158, 253, 187, 132, 252, 141, 89, 239, 101, 72, 215, 48, 31, 179, 0, 0, 127, 0, 0]) }, - "purpleblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 231, 242, 208, 209, 230, 166, 189, 219, 116, 169, 207, 54, 144, 192, 5, 112, 176, 4, 90, 141, 2, 56, 88]) }, - "purplebluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 226, 240, 208, 209, 230, 166, 189, 219, 103, 169, 207, 54, 144, 192, 2, 129, 138, 1, 108, 89, 1, 70, 54]) }, - "purplered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 244, 249, 231, 225, 239, 212, 185, 218, 201, 148, 199, 223, 101, 176, 231, 41, 138, 206, 18, 86, 152, 0, 67, 103, 0, 31]) }, - "redpurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 243, 253, 224, 221, 252, 197, 192, 250, 159, 181, 247, 104, 161, 221, 52, 151, 174, 1, 126, 122, 1, 119, 73, 0, 106]) }, - "yellowgreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 247, 252, 185, 217, 240, 163, 173, 221, 142, 120, 198, 121, 65, 171, 93, 35, 132, 67, 0, 104, 55, 0, 69, 41]) }, - "yellowgreenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 217, 237, 248, 177, 199, 233, 180, 127, 205, 187, 65, 182, 196, 29, 145, 192, 34, 94, 168, 37, 52, 148, 8, 29, 88]) }, - "yelloworangebrown": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 255, 247, 188, 254, 227, 145, 254, 196, 79, 254, 153, 41, 236, 112, 20, 204, 76, 2, 153, 52, 4, 102, 37, 6]) }, - "yelloworangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 204, 255, 237, 160, 254, 217, 118, 254, 178, 76, 253, 141, 60, 252, 78, 42, 227, 26, 28, 189, 0, 38, 128, 0, 38]) }, - "brownbluegreen": { type: PaletteType.diverging, colors: new Uint8Array([84, 48, 5, 140, 81, 10, 191, 129, 45, 223, 194, 125, 246, 232, 195, 245, 245, 245, 199, 234, 229, 128, 205, 193, 53, 151, 143, 1, 102, 94, 0, 60, 48]) }, - "pinkyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([142, 1, 82, 197, 27, 125, 222, 119, 174, 241, 182, 218, 253, 224, 239, 247, 247, 247, 230, 245, 208, 184, 225, 134, 127, 188, 65, 77, 146, 33, 39, 100, 25]) }, - "purplegreen": { type: PaletteType.diverging, colors: new Uint8Array([64, 0, 75, 118, 42, 131, 153, 112, 171, 194, 165, 207, 231, 212, 232, 247, 247, 247, 217, 240, 211, 166, 219, 160, 90, 174, 97, 27, 120, 55, 0, 68, 27]) }, - "purpleorange": { type: PaletteType.diverging, colors: new Uint8Array([127, 59, 8, 179, 88, 6, 224, 130, 20, 253, 184, 99, 254, 224, 182, 247, 247, 247, 216, 218, 235, 178, 171, 210, 128, 115, 172, 84, 39, 136, 45, 0, 75]) }, - "redblue": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 247, 247, 247, 209, 229, 240, 146, 197, 222, 67, 147, 195, 33, 102, 172, 5, 48, 97]) }, - "redgrey": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 255, 255, 255, 224, 224, 224, 186, 186, 186, 135, 135, 135, 77, 77, 77, 26, 26, 26]) }, - "redyellowblue": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 144, 255, 255, 191, 224, 243, 248, 171, 217, 233, 116, 173, 209, 69, 117, 180, 49, 54, 149]) }, - "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, - "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, - "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, - "category10": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 255, 127, 14, 44, 160, 44, 214, 39, 40, 148, 103, 189, 140, 86, 75, 227, 119, 194, 127, 127, 127, 188, 189, 34, 23, 190, 207]) }, - "category20": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 174, 199, 232, 255, 127, 14, 255, 187, 120, 44, 160, 44, 152, 223, 138, 214, 39, 40, 255, 152, 150, 148, 103, 189, 197, 176, 213, 140, 86, 75, 196, 156, 148, 227, 119, 194, 247, 182, 210, 127, 127, 127, 199, 199, 199, 188, 189, 34, 219, 219, 141, 23, 190, 207, 158, 218, 229]) }, - "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, - "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, - "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, - "pastel2": { type: PaletteType.qualitative, colors: new Uint8Array([179, 226, 205, 253, 205, 172, 203, 213, 232, 244, 202, 228, 230, 245, 201, 255, 242, 174, 241, 226, 204, 204, 204, 204]) }, - "set1": { type: PaletteType.qualitative, colors: new Uint8Array([228, 26, 28, 55, 126, 184, 77, 175, 74, 152, 78, 163, 255, 127, 0, 255, 255, 51, 166, 86, 40, 247, 129, 191, 153, 153, 153]) }, - "set2": { type: PaletteType.qualitative, colors: new Uint8Array([102, 194, 165, 252, 141, 98, 141, 160, 203, 231, 138, 195, 166, 216, 84, 255, 217, 47, 229, 196, 148, 179, 179, 179]) }, - "set3": { type: PaletteType.qualitative, colors: new Uint8Array([141, 211, 199, 255, 255, 179, 190, 186, 218, 251, 128, 114, 128, 177, 211, 253, 180, 98, 179, 222, 105, 252, 205, 229, 217, 217, 217, 188, 128, 189, 204, 235, 197, 255, 237, 111]) } - }; - } - } - class PaletteBase { - get colors() { - return this._colors; - } - set colors(value2) { - if (this._colors != value2) { - this._colors = value2; - this._changed = true; - } - } - constructor() { - this._colors = null; - } - copyFrom(palette) { - if (palette.colors) { - this.colors = new Uint8Array(palette.colors); - } else { - this.colors = null; - } - } - update() { - } - } - let Palette$3 = class Palette extends PaletteBase { - }; - class PositionVertex { - static getPosition(buffer, index2, value2) { - const offset2 = index2 * PositionVertex.SIZE; - set$8(value2, buffer[offset2], buffer[offset2 + 1], buffer[offset2 + 2]); - } - static setPosition(buffer, index2, value2) { - const offset2 = index2 * PositionVertex.SIZE; - buffer[offset2] = value2[0]; - buffer[offset2 + 1] = value2[1]; - buffer[offset2 + 2] = value2[2]; - } - } - PositionVertex.SIZE = 3; - PositionVertex.SIZE_BYTES = 12; - class PositionColorVertex { - static getPosition(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); - } - static setPosition(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - } - static getColor(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; - set$8(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255); - } - static setColor(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset2, value2[0] * 255); - bufferView.setUint8(offset2 + 1, value2[1] * 255); - bufferView.setUint8(offset2 + 2, value2[2] * 255); - } - } - PositionColorVertex.SIZE_BYTES = 16; - PositionColorVertex.POSITION_OFFSET_BYTES = 0; - PositionColorVertex.COLOR_OFFSET_BYTES = 12; - class PositionTextureVertex { - static getPosition(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); - } - static setPosition(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - } - static getTexCoord(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); - } - static setTexCoord(bufferView, index2, value2) { - const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset2, value2[0] * 65535, true); - bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); - } - } - PositionTextureVertex.SIZE_BYTES = 16; - PositionTextureVertex.POSITION_OFFSET_BYTES = 0; - PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; - class PositionTexturePickVertex { - static getPosition(bufferView, index2, value2) { - const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); - } - static setPosition(bufferView, index2, value2) { - const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - } - static getTexCoord(bufferView, index2, value2) { - const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); - } - static setTexCoord(bufferView, index2, value2) { - const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset2, value2[0] * 65535, true); - bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); - } - static getIdColor(bufferView, index2, value2) { - const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; - set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); - } - static setIdColor(bufferView, index2, value2) { - const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset2, value2[0] * 255); - bufferView.setUint8(offset2 + 1, value2[1] * 255); - bufferView.setUint8(offset2 + 2, value2[2] * 255); - bufferView.setUint8(offset2 + 3, value2[3] * 255); - } - } - PositionTexturePickVertex.SIZE_BYTES = 20; - PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; - PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; - PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; - class PositionNormalTextureVertex { - static getPosition(bufferView, index2, value2) { - const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); - } - static setPosition(bufferView, index2, value2) { - const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - } - static getNormal(bufferView, index2, value2) { - const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; - set$8(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); - } - static setNormal(bufferView, index2, value2) { - const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset2, value2[0] * 127); - bufferView.setInt8(offset2 + 1, value2[1] * 127); - bufferView.setInt8(offset2 + 2, value2[2] * 127); - } - static getTexCoord(bufferView, index2, value2) { - const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); - } - static setTexCoord(bufferView, index2, value2) { - const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset2, value2[0] * 65535, true); - bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); - } - } - PositionNormalTextureVertex.SIZE_BYTES = 20; - PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; - PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; - PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; - class PickGridVertex { - static getTranslation(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; - set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); - } - static setTranslation(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - } - static getNormal(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; - set$8(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); - } - static setNormal(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset2, value2[0] * 127); - bufferView.setInt8(offset2 + 1, value2[1] * 127); - bufferView.setInt8(offset2 + 2, value2[2] * 127); - } - static getIdColor(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; - set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); - } - static setIdColor(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset2, value2[0] * 255); - bufferView.setUint8(offset2 + 1, value2[1] * 255); - bufferView.setUint8(offset2 + 2, value2[2] * 255); - bufferView.setUint8(offset2 + 3, value2[3] * 255); - } - static getTexCoord(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); - } - static setTexCoord(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset2, value2[0] * 65535, true); - bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); - } - static getBounds(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; - set$7(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535, bufferView.getUint16(offset2 + 4, true) / 65535, bufferView.getUint16(offset2 + 6, true) / 65535); - } - static setBounds(bufferView, index2, value2) { - const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; - bufferView.setUint16(offset2, value2[0] * 65535, true); - bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); - bufferView.setUint16(offset2 + 4, value2[2] * 65535, true); - bufferView.setUint16(offset2 + 6, value2[3] * 65535, true); - } - } - PickGridVertex.SIZE_BYTES = 32; - PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; - PickGridVertex.NORMAL_OFFSET_BYTES = 12; - PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; - PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; - PickGridVertex.BOUNDS_OFFSET_BYTES = 24; - class UnitVertex { - static getIdHover(bufferView, index2) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, true); - } - static setIdHover(bufferView, index2, value2) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, value2, true); - } - static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); - } - static getTranslation(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; - set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); - } - static setTranslation(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - } - static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; - set$5(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255); - } - static setColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset2, value2[0] * 255); - bufferView.setUint8(offset2 + 1, value2[1] * 255); - } - static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; - toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); - toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); - } - static getOrder(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; - set$5(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true)); - } - static setOrder(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - } - static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - } - static getScale(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; - set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); - } - static setScale(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - } - static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getRotation(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; - set$6(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); - } - static setRotation(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - bufferView.setFloat32(offset2 + 12, value2[3], true); - } - static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getTexCoord(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; - set$6(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); - } - static setTexCoord(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; - bufferView.setFloat32(offset2, value2[0], true); - bufferView.setFloat32(offset2 + 4, value2[1], true); - bufferView.setFloat32(offset2 + 8, value2[2], true); - bufferView.setFloat32(offset2 + 12, value2[3], true); - } - static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getIdColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; - set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); - } - static setIdColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset2, value2[0] * 255); - bufferView.setUint8(offset2 + 1, value2[1] * 255); - bufferView.setUint8(offset2 + 2, value2[2] * 255); - bufferView.setUint8(offset2 + 3, value2[3] * 255); - } - static getSelected(bufferView, index2) { - return bufferView.getInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES) / 127; - } - static setSelected(bufferView, index2, value2) { - bufferView.setInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES, value2 * 127); - } - static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); - } - static getRounding(bufferView, index2) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, true); - } - static setRounding(bufferView, index2, value2) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, value2, true); - } - static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); - } - static getParameter1(bufferView, index2) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, true); - } - static setParameter1(bufferView, index2, value2) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, value2, true); - } - static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); - } - static getParameter2(bufferView, index2) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, true); - } - static setParameter2(bufferView, index2, value2) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, value2, true); - } - static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); - } - static getMaterial(bufferView, index2) { - return bufferView.getUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES); - } - static setMaterial(bufferView, index2, value2) { - bufferView.setUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES, value2); - } - static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); - } - static getTexture(bufferView, index2) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES); - } - static setTexture(bufferView, index2, value2) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES, value2); - } - static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); - } - static getSdfBuffer(bufferView, index2) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES); - } - static setSdfBuffer(bufferView, index2, value2) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES, value2); - } - static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); - } - static getSdfBorder(bufferView, index2) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES); - } - static setSdfBorder(bufferView, index2, value2) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES, value2); - } - static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); - } - static getMatId(bufferView, index2) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES); - } - static setMatId(bufferView, index2, value2) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES, value2); - } - static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); - } - static getMatColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; - value2[0] = bufferView.getUint16(offset2) / 255; - value2[1] = bufferView.getUint16(offset2 + 2) / 255; - value2[2] = bufferView.getUint16(offset2 + 4) / 255; - } - static setMatColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; - bufferView.setUint16(offset2, value2[0] * 255); - bufferView.setUint16(offset2 + 2, value2[1] * 255); - bufferView.setUint16(offset2 + 4, value2[2] * 255); - } - static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; - toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); - toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); - toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); - } - static getMatFuzz(bufferView, index2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; - return bufferView.getUint8(offset2) / 255; - } - static setMatFuzz(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; - bufferView.setUint8(offset2, value2 * 255); - } - static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); - } - static getMatGloss(bufferView, index2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; - return bufferView.getUint8(offset2) / 255; - } - static setMatGloss(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; - bufferView.setUint8(offset2, value2 * 255); - } - static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); - } - static getMatDensity(bufferView, index2) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, true); - } - static setMatDensity(bufferView, index2, value2) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, value2, true); - } - static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); - } - static getMatRefractiveIndex(bufferView, index2) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); - } - static setMatRefractiveIndex(bufferView, index2, value2) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value2, true); - } - static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); - } - static getSegColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; - value2[0] = bufferView.getUint8(offset2) / 255; - value2[1] = bufferView.getUint8(offset2 + 1) / 255; - value2[2] = bufferView.getUint8(offset2 + 2) / 255; - value2[3] = bufferView.getUint8(offset2 + 3) / 255; - } - static setSegColor(bufferView, index2, value2) { - const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset2, value2[0] * 255); - bufferView.setUint8(offset2 + 1, value2[1] * 255); - bufferView.setUint8(offset2 + 2, value2[2] * 255); - bufferView.setUint8(offset2 + 3, value2[3] * 255); - } - static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; - toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); - toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); - toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); - toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); - } - } - UnitVertex.SIZE_BYTES = 120; - UnitVertex.ID_HOVER_OFFSET_BYTES = 0; - UnitVertex.ID_COLOR_OFFSET_BYTES = 4; - UnitVertex.ORDER_OFFSET_BYTES = 8; - UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; - UnitVertex.SELECTED_OFFSET_BYTES = 80; - UnitVertex.TRANSLATION_OFFSET_BYTES = 16; - UnitVertex.COLOR_OFFSET_BYTES = 28; - UnitVertex.MATERIAL_OFFSET_BYTES = 30; - UnitVertex.SCALE_OFFSET_BYTES = 32; - UnitVertex.ROUNDING_OFFSET_BYTES = 44; - UnitVertex.ROTATION_OFFSET_BYTES = 48; - UnitVertex.TEXCOORD_OFFSET_BYTES = 64; - UnitVertex.TEXTURE_OFFSET_BYTES = 81; - UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; - UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; - UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; - UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; - UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; - UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; - UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; - UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; - UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; - UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; - UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; - class ObjMesh { - } - class ObjHelper { - constructor(core) { - this._core = core; - } - read(data2) { - const start = window.performance.now(); - const indices = []; - const positions2 = []; - const normals = []; - const texCoords = []; - const meshes = []; - const indexOffsets = []; - const indexCounts = []; - const faceLookup = {}; - const lines = data2.split("\n"); - let faceCount = 0; - for (let i = 0; i < lines.length; i++) { - const parts = lines[i].trim().split(" "); - if (parts.length > 0) { - switch (parts[0]) { - case "o": - meshes.push(parts[1]); - indexOffsets.push(indices.length); - break; - case "v": - positions2.push(parseFloat(parts[1])); - positions2.push(parseFloat(parts[2])); - positions2.push(parseFloat(parts[3])); - break; - case "vt": - texCoords.push(parseFloat(parts[1])); - texCoords.push(parseFloat(parts[2])); - break; - case "vn": - normals.push(parseFloat(parts[1])); - normals.push(parseFloat(parts[2])); - normals.push(parseFloat(parts[3])); - break; - case "f": - for (let i2 = 0; i2 < parts.length - 1; i2++) { - const part = parts[i2 + 1]; - if (faceLookup[part] == void 0) { - faceLookup[part] = faceCount++; - } - indices.push(faceLookup[part]); - } - break; - } - } - } - for (let i = 0; i < meshes.length - 1; i++) { - indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); - } - indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); - const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); - const dataView = new DataView(vertices); - let minX = Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let minZ2 = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let maxY2 = -Number.MAX_VALUE; - let maxZ = -Number.MAX_VALUE; - const faces = Object.keys(faceLookup); - const _vec2 = create$3(); - const _vec3 = create$6(); - let hasTexCoords, hasNormals; - if (faces.length > 0) { - const faceParts = faces[0].split("/"); - hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); - hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); - } - for (let i = 0; i < faces.length; i++) { - const faceParts = faces[i].split("/"); - let index2 = (parseInt(faceParts[0]) - 1) * 3; - const x2 = positions2[index2]; - const y2 = positions2[index2 + 1]; - const z2 = positions2[index2 + 2]; - set$8(_vec3, x2, y2, z2); - PositionNormalTextureVertex.setPosition(dataView, i, _vec3); - minX = Math.min(x2, minX); - minY = Math.min(y2, minY); - minZ2 = Math.min(z2, minZ2); - maxX = Math.max(x2, maxX); - maxY2 = Math.max(y2, maxY2); - maxZ = Math.max(z2, maxZ); - if (hasNormals) { - index2 = (parseInt(faceParts[2]) - 1) * 3; - set$8(_vec3, normals[index2], normals[index2 + 1], normals[index2 + 2]); - PositionNormalTextureVertex.setNormal(dataView, i, _vec3); - } - if (hasTexCoords) { - index2 = (parseInt(faceParts[1]) - 1) * 2; - set$5(_vec2, texCoords[index2], texCoords[index2 + 1]); - PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); - } - } - const originX = (minX + maxX) / 2; - const originY = (minY + maxY2) / 2; - const originZ = (minZ2 + maxZ) / 2; - const objMesh = new ObjMesh(); - objMesh.vertices = vertices; - objMesh.indices = new Uint16Array(indices); - objMesh.meshes = meshes; - objMesh.indexOffsets = indexOffsets; - objMesh.indexCounts = indexCounts; - objMesh.indexCount = indices.length; - objMesh.minX = minX; - objMesh.minY = minY; - objMesh.minZ = minZ2; - objMesh.maxX = maxX; - objMesh.maxY = maxY2; - objMesh.maxZ = maxZ; - objMesh.originX = originX; - objMesh.originY = originY; - objMesh.originZ = originZ; - this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); - return objMesh; - } - } - class Cube { - } - Cube.POSITIONS = new Float32Array([ - -0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - 0.5, - -0.5, - 0.5, - -0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - -0.5, - -0.5, - -0.5 - ]); - Cube.INDICES = new Uint16Array([5, 4, 1, 0, 3, 4, 7, 5, 6, 1, 2, 3, 6, 7]); - Cube.CUBE_MAP_INDICES = new Uint16Array([2, 3, 1, 0, 4, 3, 7, 2, 6, 1, 5, 4, 6, 7]); - Cube.FACE_NORMALS = [ - fromValues$3(0, 1, 0), - fromValues$3(1, 0, 0), - fromValues$3(0, -1, 0), - fromValues$3(-1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(0, 0, -1) - ]; - Cube.FACE_POSITIONS = [ - fromValues$3(0, 0.5, 0), - fromValues$3(0.5, 0, 0), - fromValues$3(0, -0.5, 0), - fromValues$3(-0.5, 0, 0), - fromValues$3(0, 0, 0.5), - fromValues$3(0, 0, -0.5) - ]; - Cube.FACE_ROTATIONS = [ - fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), - fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), - fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), - fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), - fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), - fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) - ]; - Cube.EDGE_POSITIONS = [ - fromValues$3(0, 0.5, 0.5), - fromValues$3(0.5, 0.5, 0), - fromValues$3(0, 0.5, -0.5), - fromValues$3(-0.5, 0.5, 0), - fromValues$3(0, -0.5, 0.5), - fromValues$3(0.5, -0.5, 0), - fromValues$3(0, -0.5, -0.5), - fromValues$3(-0.5, -0.5, 0), - fromValues$3(0.5, 0, 0.5), - fromValues$3(0.5, 0, -0.5), - fromValues$3(-0.5, 0, -0.5), - fromValues$3(-0.5, 0, 0.5) - ]; - Cube.EDGE_NORMALS = [ - fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO) - ]; - Cube.EDGE_CORNERS = [ - [0, 1], - [1, 5], - [4, 5], - [0, 4], - [2, 3], - [2, 6], - [6, 7], - [3, 7], - [1, 2], - [5, 6], - [4, 7], - [0, 3] - ]; - Cube.EDGE_FACES = [ - [0, 4], - [0, 1], - [0, 5], - [0, 3], - [2, 4], - [2, 1], - [2, 5], - [2, 3], - [1, 4], - [1, 5], - [3, 5], - [3, 4] - ]; - Cube.EDGE_AXIS = [ - 0, - 2, - 0, - 2, - 0, - 2, - 0, - 2, - 1, - 1, - 1, - 1 - ]; - Cube.AXIS_EDGES = [ - [0, 2, 4, 6], - [8, 9, 10, 11], - [1, 3, 5, 7] - ]; - Cube.AXIS_FACES = [ - [1, 3], - [0, 2], - [4, 5] - ]; - Cube.OPPOSITE_FACES = [ - 2, - 3, - 0, - 1, - 5, - 4 - ]; - Cube.EDGE_POSITIVES = [ - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(0, 1, 0), - fromValues$3(0, 1, 0), - fromValues$3(0, 1, 0), - fromValues$3(0, 1, 0) - ]; - Cube.EDGE_FORWARDS = [ - fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO) - ]; - let ControllerVisual$1 = class ControllerVisual { - render(elapsedTime, xrFrame) { - } - update(elapsedTime) { - } - constructor(controller) { - this.controller = controller; - } - }; - class Controller { - get isInitialized() { - return this._isInitialized; - } - get mMatrix() { - return this._mMatrix; - } - get indexCount() { - return this._indexCount; - } - get vertices() { - return this._vertices; - } - get indices() { - return this._indices; - } - get texture() { - return this._texture; - } - get rayMMatrix() { - return this._rayMMatrix; - } - get rayIndexCount() { - return this._rayIndexCount; - } - get rayVertices() { - return this._rayVertices; - } - get rayIndices() { - return this._rayIndices; - } - constructor(core, options2) { - this._cubeObj = `o Cube +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["react", "react-dom"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.React, global.ReactDOM)); +})(this, function(react, react_dom) { + //#region \0rolldown/runtime.js + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __exportAll = (all, no_symbols) => { + let target = {}; + for (var name in all) __defProp(target, name, { + get: all[name], + enumerable: true + }); + if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" }); + return target; + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { + key = keys[i]; + if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { + get: ((k) => from[k]).bind(null, key), + enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable + }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { + value: mod, + enumerable: true + }) : target, mod)); + //#endregion + react = __toESM(react); + react_dom = __toESM(react_dom); + //#region ../sanddance-specs/dist/es6/constants.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var FieldNames = { + Active: "__SandDance__Active", + Collapsed: "__SandDance__Collapsed", + Contains: "__SandDance__Contains", + Count: "__SandDance__Count", + Sum: "__SandDance__Sum", + SumOfCount: "__SandDance__CountSum", + SumOfSum: "__SandDance__SumSum", + Selected: "__SandDance__Selected", + First: "__SandDance__First", + Last: "__SandDance__Last", + Top: "__SandDance__Top", + TopColor: "__SandDance__TopColor", + TopIndex: "__SandDance__TopIndex", + PowerBISelectionId: "__SandDance__PowerBISelectionId", + FacetSearch: "__SandDance__FacetSearch", + FacetTitle: "__SandDance__FacetTitle", + Ordinal: "__SandDance__Ordinal", + WrapCol: "__SandDance__WrapCol", + WrapRow: "__SandDance__WrapRow", + Value: "__SandDance__Value", + OffsetX: "__SandDance__X", + OffsetY: "__SandDance__Y", + OffsetHeight: "__SandDance__H", + OffsetWidth: "__SandDance__W" + }; + var ScaleNames = { + Color: "scale_color", + X: "scale_x", + Y: "scale_y", + Z: "scale_z" + }; + var SignalNames = { + ViewportWidth: "ViewportWidth", + ViewportHeight: "ViewportHeight", + MinCellWidth: "MinCellWidth", + MinCellHeight: "MinCellHeight", + PlotOffsetLeft: "PlotOffsetLeft", + PlotOffsetTop: "PlotOffsetTop", + PlotOffsetBottom: "PlotOffsetBottom", + PlotOffsetRight: "PlotOffsetRight", + PlotHeightIn: "PlotHeightIn", + PlotWidthIn: "PlotWidthIn", + PlotHeightOut: "PlotHeightOut", + PlotWidthOut: "PlotWidthOut", + ColorBinCount: "RoleColor_BinCountSignal", + ColorReverse: "RoleColor_ReverseSignal", + FacetAxesAdjustX: "RoleFacet_AxesAdjustSignalX", + FacetAxesAdjustY: "RoleFacet_AxesAdjustSignalY", + FacetBins: "RoleFacet_BinsSignal", + FacetVBins: "RoleFacetV_BinsSignal", + FacetPaddingTop: "FacetPaddingTop", + FacetPaddingBottom: "FacetPaddingBottom", + FacetPaddingLeft: "FacetPaddingLeft", + MarkOpacity: "Mark_OpacitySignal", + PointScale: "Chart_PointScaleSignal", + TextAngleX: "Text_AngleXSignal", + TextAngleY: "Text_AngleYSignal", + TextScale: "Text_ScaleSignal", + TextSize: "Text_SizeSignal", + TextTitleSize: "Text_TitleSizeSignal", + TreeMapMethod: "Chart_TreeMapMethodSignal", + XBins: "RoleX_BinsSignal", + YBins: "RoleY_BinsSignal", + ZHeight: "RoleZ_HeightSignal", + ZGrounded: "RoleZ_Grounded", + ZProportion: "RoleZ_ProportionSignal" + }; + var Other = "__Other"; + var ColorScaleNone = "none"; + //#endregion + //#region ../sanddance-specs/dist/es6/size.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function allowNoneForSize(specContext) { + switch (specContext.insight.totalStyle) { + case "sum-strip": + case "sum-strip-percent": + case "sum-treemap": return false; + default: return true; + } + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/barchartH.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function barchartH_default(specContext) { + var _a, _b, _c, _d; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins: 10, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins: 100 + }, + minBandWidth: 15, + showAxes + }; + const x = { title: null }; + const axisScales = { + x, + y: { title: (_a = specColumns.y) === null || _a === void 0 ? void 0 : _a.name }, + z: { title: (_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight; + if (totalStyle === "sum-strip-percent") { + x.aggregate = "percent"; + x.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "left", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + x.aggregate = "sum"; + x.title = language.sum; + const treemapProps = { + corner: "top-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + x.aggregate = "sum"; + x.title = language.sum; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + x.aggregate = "count"; + x.title = language.count; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + default: { + x.aggregate = "count"; + x.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "down-right", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; + } + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "y", + binnable: true, + axisSelection: ((_c = specColumns.y) === null || _c === void 0 ? void 0 : _c.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_d = specColumns.z) === null || _d === void 0 ? void 0 : _d.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/barchartV.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function barchartV_default(specContext) { + var _a, _b; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins: 10, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins: 100 + }, + minBandWidth: 15, + showAxes + }; + const y = { title: null }; + const axisScales = { + x: { title: specColumns.x && specColumns.x.name }, + y, + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight; + if (totalStyle === "sum-strip-percent") { + y.aggregate = "percent"; + y.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "bottom", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + y.aggregate = "sum"; + y.title = language.sum; + const treemapProps = { + corner: "bottom-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + y.aggregate = "sum"; + y.title = language.sum; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + y.aggregate = "count"; + y.title = language.count; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + default: { + y.aggregate = "count"; + y.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-up", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; + } + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "z", + axisSelection: ((_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/density.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function density_default(specContext) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const { insight, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name }, + y: { title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name }, + z: { title: (_c = specColumns.z) === null || _c === void 0 ? void 0 : _c.name } + }; + const backgroundImage = ((_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins: 10, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins: 100 + }, + minBandWidth: 15, + showAxes, + outerSignalExtents: backgroundImage && { + max: backgroundImage.extents.top, + min: backgroundImage.extents.bottom + } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins: 10, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins: 100 + }, + minBandWidth: 15, + showAxes, + outerSignalExtents: backgroundImage && { + max: backgroundImage.extents.right, + min: backgroundImage.extents.left + } + }; + const aggProps = { + onBuild: null, + aggregation: null, + sumBy: specColumns.size + }; + const layouts = [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "AggregateSquare", + props: aggProps + } + ]; + const { totalStyle, view } = insight; + switch (totalStyle) { + case "sum-treemap": { + aggProps.aggregation = "sum"; + const treemapProps = { + corner: "bottom-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + aggProps.aggregation = "sum"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + aggProps.aggregation = "count"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + default: { + aggProps.aggregation = "count"; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + maxGroupedUnits: null, + maxGroupedFillSize: null, + showAxes, + view + }; + aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled) => { + squareProps.maxGroupedUnits = aggMaxExtent; + squareProps.maxGroupedFillSize = aggMaxExtentScaled; + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; + } + } + return { + axisScales, + layouts, + specCapabilities: { + backgroundImage: true, + countsAndSums: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/grid.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function grid_default(specContext) { + var _a; + const { insight, specColumns } = specContext; + const { view } = insight; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + collapseYHeight: true, + showAxes: !insight.hideAxes, + view + }; + return { + axisScales: { z: { title: specColumns.z && specColumns.z.name } }, + layouts: [{ + layoutType: "Square", + props: squareProps + }], + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "z", + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/scatterplot.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function scatterplot_default(specContext) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const { insight, specColumns, specViewOptions } = specContext; + const backgroundImageExtents = ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative) && ((_c = insight.backgroundImage) === null || _c === void 0 ? void 0 : _c.extents); + const scatterProps = { + x: specColumns.x, + y: specColumns.y, + z: specColumns.z, + size: specColumns.size, + scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, + zGrounded: specViewOptions.language.zGrounded, + backgroundImageExtents, + showAxes: !(backgroundImageExtents || insight.hideAxes), + view: insight.view + }; + return { + axisScales: { + x: { title: (_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.name }, + y: { title: (_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.name }, + z: { title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name } + }, + layouts: [{ + layoutType: "Scatter", + props: scatterProps + }], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact" + }, + { + role: "y", + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact" + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: false + }, + { + role: "color", + allowNone: true + }, + { + role: "size", + excludeCategoric: true, + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.PointScale, SignalNames.ZGrounded] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/stacks.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function stacks_default(specContext) { + var _a, _b, _c, _d, _e, _f, _g; + const { insight, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name }, + y: { title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name }, + z: { title: specViewOptions.language.count } + }; + const backgroundImage = ((_c = specColumns.x) === null || _c === void 0 ? void 0 : _c.quantitative) && ((_d = specColumns.y) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = insight.backgroundImage) === null || _e === void 0 ? void 0 : _e.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins: 10, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins: 100 + }, + minBandWidth: 15, + showAxes, + outerSignalExtents: backgroundImage && { + max: backgroundImage.extents.top, + min: backgroundImage.extents.bottom + } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins: 10, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins: 100 + }, + minBandWidth: 15, + showAxes, + outerSignalExtents: backgroundImage && { + max: backgroundImage.extents.right, + min: backgroundImage.extents.left + } + }; + const stackProps = { + sort: specColumns.sort, + showAxes + }; + return { + axisScales, + customZScale: true, + layouts: [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "Stack", + props: stackProps + } + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/strips.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function strips_default(specContext) { + var _a; + const { insight, specColumns } = specContext; + const { view } = insight; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { z: { title: specColumns.z && specColumns.z.name } }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: specColumns.size ? "sum" : "count" + }; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal: "globalAggregateMaxExtentScaledSignal", + globalAggregateMaxExtentSignal: "globalAggregateMaxExtentSignal", + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); + } + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + allowNone: true, + excludeCategoric: true + }, + { + role: "z", + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/treemap.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function treemap_default$1(specContext) { + var _a; + const { insight, specColumns, specViewOptions } = specContext; + const { view } = insight; + const treemapProps = { + corner: "top-left", + group: specColumns.group, + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { z: { title: specColumns.z && specColumns.z.name } }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: "sum" + }; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal: "globalAggregateMaxExtentScaledSignal", + globalAggregateMaxExtentSignal: "globalAggregateMaxExtentSignal", + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); + } + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + excludeCategoric: true + }, + { + role: "group", + allowNone: true + }, + { + role: "z", + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.TreeMapMethod] + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/facetLayout.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { + let layoutPair; + const groupby = facetColumn; + const plotPadding = { + x: 0, + y: 0 + }; + let facetPadding; + switch (facetStyle) { + case "cross": + layoutPair = { + layoutType: "Cross", + props: { + axisTextColor, + colRowTitles: true, + groupbyX: groupby, + groupbyY: facetVColumn + } + }; + facetPadding = { + bottom: 40, + left: 40, + top: 0 + }; + plotPadding.y = 40; + plotPadding.x = 40; + break; + default: + layoutPair = { + layoutType: "Wrap", + props: { + axisTextColor, + cellTitles: true, + groupby + } + }; + facetPadding = { + bottom: 40, + left: 40, + top: 40 + }; + break; + } + return { + layoutPair, + facetLayout: { + facetPadding, + plotPadding + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/charts/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var map$4 = { + barchart: barchartV_default, + barchartH: barchartH_default, + barchartV: barchartV_default, + density: density_default, + grid: grid_default, + scatterplot: scatterplot_default, + stacks: stacks_default, + strips: strips_default, + treemap: treemap_default$1 + }; + function getSpecBuilderPropsForChart(specContext) { + const { insight, specColumns, specViewOptions } = specContext; + const fn = map$4[insight.chart]; + if (fn) { + const props = fn(specContext); + if (insight.columns.facet) { + const discreteFacetColumn = { + column: specColumns.facet, + defaultBins: 10, + maxbins: 100, + maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, + maxbinsSignalName: SignalNames.FacetBins + }; + const discreteFacetVColumn = { + column: specColumns.facetV, + defaultBins: 10, + maxbins: 100, + maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, + maxbinsSignalName: SignalNames.FacetVBins + }; + const { facetLayout, layoutPair } = getFacetLayout(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); + props.layouts.unshift(layoutPair); + props.facetLayout = facetLayout; + props.collapseFacetAxes = specViewOptions.collapseFacetAxes; + } + return props; + } + } + //#endregion + //#region ../../node_modules/d3-color/src/define.js + function define_default(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; + } + function extend$1(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } + //#endregion + //#region ../../node_modules/d3-color/src/color.js + function Color$2() {} + var darker = .7; + var brighter = 1 / darker; + var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + var named = { + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 + }; + define_default(Color$2, color$2, { + copy(channels) { + return Object.assign(new this.constructor(), this, channels); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + function color_formatHex() { + return this.rgb().formatHex(); + } + function color_formatHex8() { + return this.rgb().formatHex8(); + } + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + function color_formatRgb() { + return this.rgb().formatRgb(); + } + function color$2(format) { + var m, l; + format = (format + "").trim().toLowerCase(); + return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; + } + function rgbn(n) { + return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); + } + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } + function rgbConvert(o) { + if (!(o instanceof Color$2)) o = color$2(o); + if (!o) return new Rgb(); + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } + function rgb(r, g, b, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); + } + function Rgb(r, g, b, opacity) { + this.r = +r; + this.g = +g; + this.b = +b; + this.opacity = +opacity; + } + define_default(Rgb, rgb, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return -.5 <= this.r && this.r < 255.5 && -.5 <= this.g && this.g < 255.5 && -.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; + }, + hex: rgb_formatHex, + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + function rgb_formatRgb() { + const a = clampa(this.opacity); + return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; + } + function clampa(opacity) { + return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); + } + function clampi(value) { + return Math.max(0, Math.min(255, Math.round(value) || 0)); + } + function hex(value) { + value = clampi(value); + return (value < 16 ? "0" : "") + value.toString(16); + } + function hsla(h, s, l, a) { + if (a <= 0) h = s = l = NaN; + else if (l <= 0 || l >= 1) h = s = NaN; + else if (s <= 0) h = NaN; + return new Hsl(h, s, l, a); + } + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color$2)) o = color$2(o); + if (!o) return new Hsl(); + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; + if (s) { + if (r === max) h = (g - b) / s + (g < b) * 6; + else if (g === max) h = (b - r) / s + 2; + else h = (r - g) / s + 4; + s /= l < .5 ? max + min : 2 - max - min; + h *= 60; + } else s = l > 0 && l < 1 ? 0 : h; + return new Hsl(h, s, l, o.opacity); + } + function hsl$1(h, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); + } + function Hsl(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + define_default(Hsl, hsl$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < .5 ? l : 1 - l) * s, m1 = 2 * l - m2; + return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; + }, + formatHsl() { + const a = clampa(this.opacity); + return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; + } + })); + function clamph(value) { + value = (value || 0) % 360; + return value < 0 ? value + 360 : value; + } + function clampt(value) { + return Math.max(0, Math.min(1, value || 0)); + } + function hsl2rgb(h, m1, m2) { + return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; + } + //#endregion + //#region ../../node_modules/d3-color/src/math.js + var radians$2 = Math.PI / 180; + var degrees$3 = 180 / Math.PI; + //#endregion + //#region ../../node_modules/d3-color/src/lab.js + var K = 18, Xn = .96422, Yn = 1, Zn = .82521, t0$2 = 4 / 29, t1$1 = 6 / 29, t2 = 3 * t1$1 * t1$1, t3 = t1$1 * t1$1 * t1$1; + function labConvert(o) { + if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); + if (o instanceof Hcl) return hcl2lab(o); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((.2225045 * r + .7168786 * g + .0606169 * b) / Yn), x, z; + if (r === g && g === b) x = z = y; + else { + x = xyz2lab((.4360747 * r + .3850649 * g + .1430804 * b) / Xn); + z = xyz2lab((.0139322 * r + .0971045 * g + .7141733 * b) / Zn); + } + return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); + } + function lab$1(l, a, b, opacity) { + return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); + } + function Lab(l, a, b, opacity) { + this.l = +l; + this.a = +a; + this.b = +b; + this.opacity = +opacity; + } + define_default(Lab, lab$1, extend$1(Color$2, { + brighter(k) { + return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + darker(k) { + return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + rgb() { + var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; + x = Xn * lab2xyz(x); + y = Yn * lab2xyz(y); + z = Zn * lab2xyz(z); + return new Rgb(lrgb2rgb(3.1338561 * x - 1.6168667 * y - .4906146 * z), lrgb2rgb(-.9787684 * x + 1.9161415 * y + .033454 * z), lrgb2rgb(.0719453 * x - .2289914 * y + 1.4052427 * z), this.opacity); + } + })); + function xyz2lab(t) { + return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$2; + } + function lab2xyz(t) { + return t > t1$1 ? t * t * t : t2 * (t - t0$2); + } + function lrgb2rgb(x) { + return 255 * (x <= .0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - .055); + } + function rgb2lrgb(x) { + return (x /= 255) <= .04045 ? x / 12.92 : Math.pow((x + .055) / 1.055, 2.4); + } + function hclConvert(o) { + if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); + if (!(o instanceof Lab)) o = labConvert(o); + if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); + var h = Math.atan2(o.b, o.a) * degrees$3; + return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); + } + function hcl$1(h, c, l, opacity) { + return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); + } + function Hcl(h, c, l, opacity) { + this.h = +h; + this.c = +c; + this.l = +l; + this.opacity = +opacity; + } + function hcl2lab(o) { + if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); + var h = o.h * radians$2; + return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); + } + define_default(Hcl, hcl$1, extend$1(Color$2, { + brighter(k) { + return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); + }, + darker(k) { + return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); + }, + rgb() { + return hcl2lab(this).rgb(); + } + })); + //#endregion + //#region ../../node_modules/d3-color/src/cubehelix.js + var A = -.14861, B$1 = 1.78277, C$1 = -.29227, D$1 = -.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C$1 - D$1 * A; + function cubehelixConvert(o) { + if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C$1 * bl) / D$1, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * degrees$3 - 120 : NaN; + return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); + } + function cubehelix$1(h, s, l, opacity) { + return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); + } + function Cubehelix(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + define_default(Cubehelix, cubehelix$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h = isNaN(this.h) ? 0 : (this.h + 120) * radians$2, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); + return new Rgb(255 * (l + a * (A * cosh + B$1 * sinh)), 255 * (l + a * (C$1 * cosh + D$1 * sinh)), 255 * (l + a * (E * cosh)), this.opacity); + } + })); + //#endregion + //#region ../data-inference/dist/es6/color.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function isColor(cssColorSpecifier) { + return !!color$2(cssColorSpecifier); + } + function checkIsColorData(data, column) { + if (!column.stats.hasColorData) { + column.isColorData = false; + return; + } + for (let i = 0; i < data.length; i++) if (!isColor(data[i][column.name])) { + column.isColorData = false; + return; + } + column.isColorData = true; + } + //#endregion + //#region ../data-inference/dist/es6/numeric.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function isQuantitative(column) { + return column.type === "number" || column.type === "integer"; + } + function detectNegative(columnName, data) { + for (let i = 1; i < data.length; i++) if ((columnName == null ? data[i] : data[i][columnName]) < 0) return true; + return false; + } + function detectSequentialColumn(columnName, data) { + if (data.length < 2) return false; + for (let i = 1; i < data.length; i++) if ((columnName == null ? data[i] : data[i][columnName]) !== (columnName == null ? data[i - 1] : data[i - 1][columnName]) + 1) return false; + return true; + } + //#endregion + //#region ../data-inference/dist/es6/stats.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getStats(data, ...args) { + let columnName; + let columnType; + let columnQuantitative; + let distinctValuesCallback; + if (args.length <= 2) { + const column = args[0]; + columnName = column.name; + columnType = column.type; + columnQuantitative = column.quantitative; + distinctValuesCallback = args[1]; + } else { + columnName = args[0]; + columnType = args[1]; + columnQuantitative = args[2]; + distinctValuesCallback = args[3]; + } + const distinctMap = {}; + const stats = { + nonNull: 0, + distinctValueCount: null, + max: null, + mean: null, + min: null + }; + const columnIsString = columnType === "string"; + let sum = 0; + for (let i = 0; i < data.length; i++) { + const row = data[i]; + const value = columnName == null ? row : row[columnName]; + if (columnIsString) { + if (value !== "") stats.nonNull++; + } else if (value != null) stats.nonNull++; + const num = +value; + distinctMap[value] = true; + if (!isNaN(num)) { + if (stats.max === null || num > stats.max) stats.max = num; + if (stats.min === null || num < stats.min) stats.min = num; + sum += num; + } + if ((columnType === "date" || columnIsString) && !stats.hasColorData && isColor(value)) stats.hasColorData = true; + } + if (columnQuantitative) { + stats.mean = data.length > 0 && sum / data.length; + stats.hasNegative = detectNegative(columnName, data); + if (columnType === "integer") stats.isSequential = detectSequentialColumn(columnName, data); + } + const distinctValues = Object.keys(distinctMap); + if (distinctValuesCallback) { + distinctValues.sort(); + distinctValuesCallback(distinctValues); + } + stats.distinctValueCount = distinctValues.length; + return stats; + } + //#endregion + //#region ../data-inference/dist/es6/inference.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Derive column metadata from the data array. + * @param data Array of data objects. + */ + function getColumnsFromData(inferTypesFn, data, columnTypes) { + const sample = data[0]; + const fields = sample ? Object.keys(sample) : []; + const inferences = Object.assign(Object.assign({}, inferTypesFn(data, fields)), columnTypes); + const columns = fields.map((name) => { + return { + name, + type: inferences[name] + }; + }); + inferAll(columns, data); + return columns; + } + /** + * Populate columns with type inferences and stats. + * @param columns Array of columns. + * @param data Array of data objects. + */ + function inferAll(columns, data) { + columns.forEach((column) => { + if (column) { + if (typeof column.quantitative !== "boolean") column.quantitative = isQuantitative(column); + if (!column.stats) column.stats = getStats(data, column); + if ((column.type === "date" || column.type === "string") && typeof column.isColorData !== "boolean") checkIsColorData(data, column); + } + }); + } + //#endregion + //#region ../data-inference/dist/es6/summary.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Table$2 = class { + constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = "right") { + this.columns = columns; + this.rows = rows; + this.maxWidth = maxWidth; + this.underlineHeaders = underlineHeaders; + this.align = align; + this.columnWidths = this.columns.map((col, idx) => Math.max(col.length, ...this.rows.map((row) => { + var _a; + return ((_a = row[idx]) === null || _a === void 0 ? void 0 : _a.length) || 0; + }))); + } + createSpaces(num) { + return " ".repeat(num); + } + groupColumns() { + let cumulativeWidth = 0; + const columnGroups = []; + let currentGroup = []; + this.columns.forEach((col, idx) => { + const columnSpace = this.columnWidths[idx] + 1; + if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { + columnGroups.push(currentGroup); + cumulativeWidth = columnSpace; + currentGroup = [col]; + } else { + cumulativeWidth += columnSpace; + currentGroup.push(col); + } + }); + if (currentGroup.length > 0) columnGroups.push(currentGroup); + return columnGroups; + } + formatRow(row, group) { + return group.map((col) => { + const idx = this.columns.indexOf(col); + const cellValue = row[idx] == null ? "" : row[idx].toString(); + return this.align === "right" ? cellValue.padStart(this.columnWidths[idx], " ") : cellValue.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); + } + formatHeader(group) { + return group.map((col) => { + const idx = this.columns.indexOf(col); + return this.align === "right" ? col.padStart(this.columnWidths[idx], " ") : col.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); + } + underlineHeader(group) { + return group.map((col) => "-".repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); + } + render() { + const output = []; + const columnGroups = this.groupColumns(); + columnGroups.forEach((group, groupIndex) => { + let section = this.formatHeader(group) + (groupIndex < columnGroups.length - 1 ? " \\" : "") + "\n"; + if (this.underlineHeaders) section += this.underlineHeader(group) + "\n"; + this.rows.forEach((row) => { + section += this.formatRow(row, group) + "\n"; + }); + output.push(section); + if (groupIndex < columnGroups.length - 1) output.push("\n"); + }); + return output.join(""); + } + }; + var pandasSimulation; + (function(pandasSimulation) { + const typeMapping = { + boolean: "bool", + number: "float64", + date: "datetime64[ns]", + string: "object", + integer: "int64" + }; + function head(columns, data, maxWidth = 80) { + const numRows = 5; + const top = data.slice(0, numRows); + const rowNumbers = Array.from({ length: numRows }, (_, i) => (i + 1).toString()); + return new Table$2([""].concat(columns.map((col) => col.name)), top.map((row, i) => [rowNumbers[i]].concat(columns.map((col) => { + var _a; + return ((_a = row[col.name]) === null || _a === void 0 ? void 0 : _a.toString()) || ""; + }))), maxWidth, false, "right").render(); + } + pandasSimulation.head = head; + function info(columns, data, maxWidth = 80) { + const numRows = data.length; + const output = []; + output.push(""); + output.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); + output.push(`Data columns (total ${columns.length} columns):\n`); + const table = new Table$2([ + "#", + "Column", + "Non-Null Count", + "Dtype" + ], columns.map((col, idx) => { + const nonNullCount = col.stats.nonNull.toString(); + const dtype = typeMapping[col.type] || "unknown"; + return [ + idx.toString(), + col.name, + `${nonNullCount} non-null`, + dtype + ]; + }), maxWidth, true, "left"); + output.push(table.render()); + const memoryUsage = columns.reduce((total, col) => { + var _a; + const exampleValue = (_a = data.find((row) => row[col.name] != null)) === null || _a === void 0 ? void 0 : _a[col.name]; + if (exampleValue == null) return total; + return total + new Blob([exampleValue.toString()]).size * numRows; + }, 0); + output.push(`\ndtypes: ${columns.filter((col) => col.type === "number").length} float64, ${columns.filter((col) => col.type === "integer").length} int64, ${columns.filter((col) => col.type === "string").length} object`); + output.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); + return output.join("\n"); + } + pandasSimulation.info = info; + })(pandasSimulation || (pandasSimulation = {})); + //#endregion + //#region ../data-inference/dist/es6/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../sanddance-specs/dist/es6/inference.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Get columns associated with each Insight role. + * @param insight Insight to specify column roles. + * @param columns Array of Columns inferred from the data. + */ + function getSpecColumns(insight, columns) { + function getColumnByName(name) { + return columns.filter((c) => c.name === name)[0]; + } + return { + color: getColumnByName(insight.columns && insight.columns.color), + facet: getColumnByName(insight.columns && insight.columns.facet), + facetV: getColumnByName(insight.columns && insight.columns.facetV), + group: getColumnByName(insight.columns && insight.columns.group), + size: getColumnByName(insight.columns && insight.columns.size), + sort: getColumnByName(insight.columns && insight.columns.sort), + uid: getColumnByName(insight.columns && insight.columns.uid), + x: getColumnByName(insight.columns && insight.columns.x), + y: getColumnByName(insight.columns && insight.columns.y), + z: getColumnByName(insight.columns && insight.columns.z) + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/scope.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addAxes(scope, ...axes) { + if (!axes || !axes.length) return; + if (!scope.axes) scope.axes = []; + scope.axes.push(...axes.filter(Boolean)); + } + function addData(scope, ...datas) { + if (!datas || !datas.length) return; + if (!scope.data) scope.data = []; + scope.data.push(...datas.filter(Boolean)); + } + function addMarks(scope, ...marks) { + if (!marks || !marks.length) return; + if (!scope.marks) scope.marks = []; + scope.marks.push(...marks.filter(Boolean)); + } + function addScales(scope, ...scales) { + if (!scales || !scales.length) return; + if (!scope.scales) scope.scales = []; + scope.scales.push(...scales.filter(Boolean)); + } + function addSignals(scope, ...signals) { + if (!signals || !signals.length) return; + if (!scope.signals) scope.signals = []; + scope.signals.push(...signals.filter(Boolean)); + } + function addTransforms(data, ...transforms) { + if (!transforms || !transforms.length) return; + if (!data.transform) data.transform = []; + data.transform.push(...transforms.filter(Boolean)); + } + function getDataByName(data, dataName) { + for (let i = 0; i < data.length; i++) if (data[i].name === dataName) return { + data: data[i], + index: i + }; + } + function getGroupBy(groupings) { + return groupings.map((g) => g.groupby).reduce((acc, val) => acc.concat(val), []); + } + function addOffsets(...offsets) { + return offsets.filter(Boolean).join(" + "); + } + //#endregion + //#region ../sanddance-specs/dist/es6/axes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addGlobalAxes(props) { + const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; + const { scope } = globalScope; + allGlobalScales.forEach((globalScales) => { + const { scales } = globalScales; + for (const xyz in scales) { + const _scales = scales[xyz]; + if (_scales) { + addScales(scope, ..._scales); + let { showAxes } = globalScales; + let zindex = void 0; + if (xyz === "z") { + showAxes = false; + if (props.view === "3d" && specViewOptions.zAxisOptions && !props.hideZAxis) { + if (specViewOptions.zAxisOptions.showZAxis) { + showAxes = true; + zindex = specViewOptions.zAxisOptions.zIndex; + } + } + } + if (showAxes && axisScales) { + const axisScale = axisScales[xyz]; + if (axisScale) { + const lineColor = specViewOptions.colors.axisLine; + const horizontal = xyz === "x"; + const column = specColumns[xyz] || { quantitative: true }; + const props = { + title: axisScale.title, + horizontal, + column, + specViewOptions, + lineColor, + titlePadding: axesTitlePadding[xyz], + labelBaseline: labelBaseline[xyz], + zindex + }; + axesScopes["main"].forEach((a) => addAxes(a.scope, createAxis(Object.assign(Object.assign({}, props), { + scale: a.scale || _scales[0], + showTitle: a.title, + showLabels: a.labels, + showLines: a.lines + })))); + if (axesScopes[xyz]) axesScopes[xyz].forEach((a) => addAxes(a.scope, createAxis(Object.assign(Object.assign({}, props), { + scale: a.scale || _scales[0], + showTitle: a.title, + showLabels: a.labels, + showLines: a.lines + })))); + if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { + const plotOffsetSignal = plotOffsetSignals[xyz]; + plotOffsetSignal.update = `${axesOffsets[xyz]}`; + } + } + } + } + } + }); + } + function createAxis(props) { + const { column, horizontal, labelBaseline, lineColor, scale, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; + const axis = Object.assign(Object.assign(Object.assign(Object.assign({ + zindex, + scale: scale.name, + orient: horizontal ? "bottom" : "left", + domain: showLines, + ticks: showLines + }, showLines && { + domainColor: lineColor, + tickColor: lineColor, + tickSize: specViewOptions.tickSize + }), showTitle && { + title, + titleAlign: horizontal ? "left" : "right", + titleAngle: { signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY }, + titleColor: specViewOptions.colors.axisText, + titleFontSize: { signal: SignalNames.TextTitleSize }, + titleLimit: 100, + titlePadding + }), { labels: showLabels }), showLabels && { + labelAlign: horizontal ? "left" : "right", + labelBaseline, + labelAngle: { signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY }, + labelColor: specViewOptions.colors.axisText, + labelFontSize: { signal: SignalNames.TextSize }, + labelLimit: 100 + }); + if (column.quantitative) axis.format = "~r"; + return axis; + } + //#endregion + //#region ../sanddance-specs/dist/es6/expr.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Make sure that the field name is accessible via Vega's Field type + * https://vega.github.io/vega/docs/types/#Field + * examples: "source.x", "target['x']", "[my.field]" + */ + function safeFieldName(field) { + return field.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, "\\\"").replace(/\./g, "\\.").replace(/\[/g, "\\[").replace(/\]/g, "\\]"); + } + /** + * Make sure the field name is usable in a Vega expression + */ + function exprSafeFieldName(field) { + return field.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ""); + } + //#endregion + //#region ../sanddance-specs/dist/es6/scales.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function linearScale(scaleName, domain, range, reverse, zero, nice = true) { + return { + name: scaleName, + type: "linear", + range, + round: true, + reverse, + domain, + zero, + nice + }; + } + function pointScale(scaleName, data, range, field, reverse) { + const scale = { + name: scaleName, + type: "point", + range, + domain: { + data, + field: safeFieldName(field), + sort: true + }, + padding: .5 + }; + if (reverse !== void 0) scale.reverse = reverse; + return scale; + } + function binnableColorScale(scaleName, colorBin, data, field, scheme) { + scheme = scheme || "none"; + const domain = { + data, + field: safeFieldName(field) + }; + const range = { scheme }; + const reverse = { signal: SignalNames.ColorReverse }; + if (colorBin !== "continuous") range.count = { signal: SignalNames.ColorBinCount }; + switch (colorBin) { + case "continuous": return { + name: scaleName, + type: "linear", + domain, + range, + reverse + }; + case "quantile": return { + name: scaleName, + type: "quantile", + domain, + range, + reverse + }; + default: return { + name: scaleName, + type: "quantize", + domain, + range, + reverse + }; + } + } + //#endregion + //#region ../sanddance-specs/dist/es6/signals.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var defaultZProportion = .6; + function textSignals(context, heightSignal) { + const { specViewOptions } = context; + return [ + { + name: SignalNames.ZProportion, + value: defaultZProportion, + bind: { + name: specViewOptions.language.zScaleProportion, + debounce: 250, + input: "range", + min: .1, + max: 2, + step: .1 + } + }, + { + name: SignalNames.ZHeight, + update: `${heightSignal} * ${SignalNames.ZProportion}` + }, + { + name: SignalNames.TextScale, + value: 1.2, + bind: { + name: specViewOptions.language.textScaleSignal, + debounce: 250, + input: "range", + min: .5, + max: 2, + step: .1 + } + }, + { + name: SignalNames.TextSize, + update: `${SignalNames.TextScale} * 10` + }, + { + name: SignalNames.TextTitleSize, + update: `${SignalNames.TextScale} * 15` + }, + { + name: SignalNames.TextAngleX, + value: 30, + bind: { + name: specViewOptions.language.xAxisTextAngleSignal, + debounce: 250, + input: "range", + min: 0, + max: 90, + step: 1 + } + }, + { + name: SignalNames.TextAngleY, + value: 0, + bind: { + name: specViewOptions.language.yAxisTextAngleSignal, + debounce: 250, + input: "range", + min: -90, + max: 0, + step: 1 + } + }, + { + name: SignalNames.MarkOpacity, + value: 1, + bind: { + name: specViewOptions.language.markOpacitySignal, + debounce: 250, + input: "range", + min: .1, + max: 1, + step: .05 + } + } + ]; + } + function colorBinCountSignal(context) { + const { specViewOptions } = context; + return { + name: SignalNames.ColorBinCount, + value: 7, + bind: { + name: specViewOptions.language.colorBinCount, + debounce: 250, + input: "range", + min: 1, + max: specViewOptions.maxLegends + 1, + step: 1 + } + }; + } + function colorReverseSignal(context) { + const { specViewOptions } = context; + return { + name: SignalNames.ColorReverse, + value: false, + bind: { + name: specViewOptions.language.colorReverse, + input: "checkbox" + } + }; + } + function modifySignal(s, fn, update) { + s.update = `${fn}((${s.update}), (${update}))`; + } + //#endregion + //#region ../sanddance-specs/dist/es6/legends.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function legend(column, fill) { + const legend = { + orient: "none", + title: column.name, + fill, + encode: { symbols: { update: { shape: { value: "square" } } } } + }; + if (column.quantitative) { + legend.type = "symbol"; + legend.format = "~r"; + } + return legend; + } + function getLegends(context, fill) { + const { specColumns, insight } = context; + if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) return [legend(specColumns.color, fill)]; + } + //#endregion + //#region ../sanddance-specs/dist/es6/top.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function topLookup(column, count, source, legend, lookupName, fieldName, indexName) { + return [{ + name: lookupName, + source, + transform: [ + { + type: "aggregate", + groupby: [safeFieldName(column.name)] + }, + { + type: "window", + ops: ["count"], + as: [indexName] + }, + { + type: "filter", + expr: `datum[${JSON.stringify(indexName)}] <= ${count}` + } + ] + }, { + name: legend, + source, + transform: [{ + type: "lookup", + from: lookupName, + key: safeFieldName(column.name), + fields: [column.name].map(safeFieldName), + values: [column.name].map(safeFieldName), + as: [fieldName] + }, { + type: "formula", + expr: `datum[${JSON.stringify(fieldName)}] == null ? '${Other}' : datum[${JSON.stringify(fieldName)}]`, + as: fieldName + }] + }]; + } + //#endregion + //#region ../sanddance-specs/dist/es6/color.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addColor(props) { + const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; + let colorDataName = dataName; + const { insight, specColumns, specViewOptions } = specContext; + const legends = getLegends(specContext, scaleName); + if (legends) scope.legends = legends; + if (specColumns.color && !specColumns.color.quantitative) { + addData(scope, ...topLookup(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, FieldNames.TopColor, FieldNames.TopIndex)); + colorDataName = legendDataName; + } + if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) if (specColumns.color.quantitative) addScales(scope, binnableColorScale(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); + else addScales(scope, { + name: scaleName, + type: "ordinal", + domain: { + data: colorDataName, + field: FieldNames.TopColor, + sort: true + }, + range: { scheme: insight.scheme || "none" }, + reverse: { signal: colorReverseSignalName } + }); + addSignals(scope, colorBinCountSignal(specContext), colorReverseSignal(specContext)); + return { + topColorField: FieldNames.TopColor, + colorDataName + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/facetTitle.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { + const titleSignal = `parent[${JSON.stringify(FieldNames.FacetTitle)}]`; + const index = `datum[${JSON.stringify(FieldNames.Ordinal)}] - 1`; + const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index); + const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index); + addMarks(globalScope, col.header, row.footer); + addMarks(col.header, { + type: "text", + encode: { + enter: { + align: { value: "center" }, + baseline: { value: "middle" }, + fill: { value: axisTextColor } + }, + update: { + metaData: { signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` }, + x: { signal: `${sizeSignals.layoutWidth} / 2` }, + limit: { signal: sizeSignals.layoutWidth }, + fontSize: { signal: SignalNames.TextSize }, + text: { signal: titleSignal } + } + } + }); + addMarks(row.footer, { + type: "text", + encode: { + enter: { + align: { value: "left" }, + baseline: { value: "middle" }, + fill: { value: axisTextColor } + }, + update: { + metaData: { signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` }, + y: { signal: `${sizeSignals.layoutHeight} / 2` }, + limit: { signal: SignalNames.PlotOffsetRight }, + fontSize: { signal: SignalNames.TextSize }, + text: { signal: titleSignal } + } + } + }); + } + function addFacetCellTitles(scope, sizeSignals, axisTextColor) { + addMarks(scope, { + type: "text", + encode: { + enter: { + align: { value: "center" }, + baseline: { value: "bottom" }, + fill: { value: axisTextColor } + }, + update: { + metaData: { signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` }, + x: { signal: `(${sizeSignals.layoutWidth}) / 2` }, + text: { signal: `parent[${JSON.stringify(FieldNames.FacetTitle)}]` }, + fontSize: { signal: SignalNames.TextSize }, + limit: { signal: sizeSignals.layoutWidth }, + y: { signal: `-${SignalNames.FacetPaddingTop} / 2` } + } + } + }); + } + function addFacetAxesGroupMarks(props) { + const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; + const { sizeSignals } = facetScope; + const colSequence = createSequence(colSeqName, sizeSignals.colCount); + const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); + const index = "datum.data"; + const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index); + const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index); + addData(globalScope, colSequence, rowSequence); + addMarks(globalScope, col.footer, row.header); + addScales(globalScope, colTitleScale, rowTitleScale); + return { + main: [{ + scope: facetScope.facetScope, + lines: true, + labels: false, + title: false + }], + x: [{ + scope: col.footer, + lines: true, + labels: true, + title: false + }, { + scope: plotScope, + scale: colTitleScale, + lines: false, + labels: false, + title: true + }], + y: [{ + scope: row.header, + lines: true, + labels: true, + title: false + }, { + scope: plotScope, + scale: rowTitleScale, + lines: false, + labels: false, + title: true + }] + }; + } + function facetRowHeaderFooter(data, sizeSignals, index) { + const rowFn = (xSignal) => { + return { + type: "group", + from: { data }, + encode: { update: { + x: { signal: xSignal }, + y: { signal: `${SignalNames.PlotOffsetTop} + ${SignalNames.FacetPaddingTop} + (${index}) * (${sizeSignals.layoutHeight} + ${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})` }, + height: { signal: sizeSignals.layoutHeight } + } } + }; + }; + return { + header: rowFn(SignalNames.PlotOffsetLeft), + footer: rowFn(`${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetRight} / 2`) + }; + } + function facetColumnHeaderFooter(data, sizeSignals, index) { + const colFn = (ySignal) => { + return { + type: "group", + from: { data }, + encode: { update: { + x: { signal: `(${index}) * (${sizeSignals.layoutWidth} + ${SignalNames.FacetPaddingLeft}) + ${SignalNames.FacetPaddingLeft} + ${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, + y: { signal: `${ySignal} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: sizeSignals.layoutWidth } + } } + }; + }; + return { + header: colFn(`${SignalNames.PlotOffsetTop} / 2`), + footer: colFn(`${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut}`) + }; + } + function createSequence(dataName, countSignal) { + return { + name: dataName, + transform: [{ + type: "sequence", + start: 0, + stop: { signal: countSignal } + }] + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/fill.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function fill$1(context, colorFieldName, scale) { + const { specColumns, insight, specViewOptions } = context; + const colorColumn = specColumns.color; + return colorColumn ? colorColumn.isColorData || insight.directColor ? { field: safeFieldName(colorColumn.name) } : { + scale, + field: colorColumn.quantitative ? safeFieldName(colorColumn.name) : colorFieldName + } : { value: specViewOptions.colors.defaultCube }; + } + function opacity(context) { + return { signal: SignalNames.MarkOpacity }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/globalScope.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var GlobalScope = class { + constructor(props) { + const { dataName, markGroup, scope, signals } = props; + this.scope = scope; + this._markGroup = markGroup; + this.signals = signals; + this.data = getDataByName(scope.data, dataName).data; + this._markDataName = dataName; + this.offsets = { + x: "0", + y: "0", + h: SignalNames.PlotHeightIn, + w: SignalNames.PlotWidthIn + }; + this.sizeSignals = { + layoutHeight: SignalNames.PlotHeightIn, + layoutWidth: SignalNames.PlotWidthIn + }; + this.zSize = SignalNames.PlotHeightIn; + } + get markDataName() { + return this._markDataName; + } + setMarkDataName(markDataName) { + this._markDataName = markDataName; + } + get markGroup() { + return this._markGroup; + } + setMarkGroup(markGroup) { + this._markGroup = markGroup; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/layout.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Layout = class { + constructor(props) { + this.props = props; + this.id = props.id; + } + getGrouping() { + return null; + } + getAggregateSumOp() { + return null; + } + build() { + throw "Not implemented"; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/selection.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function testForCollapseSelection() { + return `datum.${FieldNames.Collapsed}`; + } + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/aggregateContainer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AggregateContainer = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const a = this.aggregation = this.getAggregation(); + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a}_extent`, + scale: `scale_${p}`, + extentData: `data_${p}_extent`, + offsets: `data_${p}_offsets` + }; + } + getAggregateSumOp() { + if (this.aggregation === "sum") return { + field: safeFieldName(this.props.sumBy.name), + op: "sum", + as: FieldNames.Sum + }; + } + build() { + const { aggregation, names, props } = this; + const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentSignal, + update: `${names.globalAggregateExtentSignal}[1]` + }); + const horizontal = dock === "left"; + const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; + const offsets = { + x: parentScope.offsets.x, + y: addOffsets(parentScope.offsets.y, dock === "bottom" ? groupScaled : ""), + h: horizontal ? parentScope.offsets.h : dock === "top" ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, + w: horizontal ? groupScaled : parentScope.offsets.w + }; + const scale = { + type: "linear", + name: names.scale, + domain: [0, { signal: props.globalAggregateMaxExtentSignal }], + range: horizontal ? [0, { signal: parentScope.sizeSignals.layoutWidth }] : [{ signal: parentScope.sizeSignals.layoutHeight }, 0], + nice: niceScale, + zero: true, + reverse: dock === "top" + }; + const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentScaledSignal, + update: dock === "bottom" ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue + }); + return { + offsets, + sizeSignals: horizontal ? { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: null + } : { + layoutHeight: null, + layoutWidth: parentScope.sizeSignals.layoutWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? [scale] : void 0, + y: horizontal ? void 0 : [scale] + } + }, + encodingRuleMap: horizontal ? { + x: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.x + }], + width: [{ + test: testForCollapseSelection(), + value: 0 + }] + } : { + y: [{ + test: testForCollapseSelection(), + signal: dock === "top" ? parentScope.offsets.y : addOffsets(parentScope.offsets.y, parentScope.offsets.h) + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") trans.fields = [this.props.sumBy.name].map(safeFieldName); + return trans; + } + getAggregation() { + const { props } = this; + let s; + if (props.dock === "left") s = props.axesScales.x; + else s = props.axesScales.y; + switch (s.aggregate) { + case "sum": return "sum"; + default: return "count"; + } + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/aggregateSquare.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AggregateSquare = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const a = this.props.aggregation; + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a}_extent`, + extentData: `data_${p}_extent` + }; + } + build() { + const { names, props } = this; + const { aggregation, globalScope, groupings, onBuild, parentScope } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; + const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; + const squareSide = `sqrt(${`(${[`(${[squareMaxSide, squareMaxSide].join(" * ")})`, `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`].join(" * ")})`})`; + onBuild && onBuild(localAggregateMaxExtent, squareSide); + const offsets = { + x: addOffsets(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), + y: addOffsets(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), + h: squareSide, + w: squareSide + }; + return { + offsets, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: offsets.y + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") trans.fields = [this.props.sumBy.name].map(safeFieldName); + return trans; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/transforms.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function dataExtent(column, signal) { + return { + type: "extent", + field: safeFieldName(column.name), + signal + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/bin.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { + const { column, defaultBins, maxbins, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; + if (column.quantitative) { + const field = `${prefix}_bin_${exprSafeFieldName(column.name)}`; + const fieldEnd = `${field}_end`; + const binSignal = `${field}_bins`; + const dataExtentSignal = `${field}_bin_extent`; + const dataExtentSpanSignal = `${field}_bin_extent_span`; + const outerSignal = `${field}_outer_extent`; + domainDataName = `${field}_sequence`; + const extentTransform = dataExtent(column, dataExtentSignal); + let imageSignal; + if (outerSignalExtents) imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); + const maxbinsSignal = { + name: maxbinsSignalName, + value: defaultBins, + bind: { + name: maxbinsSignalDisplayName, + debounce: 250, + input: "range", + min: 1, + max: maxbins, + step: 1 + } + }; + const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; + const binTransform = { + type: "bin", + field: safeFieldName(column.name), + as: [field, fieldEnd], + signal: binSignal, + extent: { signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` }, + minstep: shouldBeIntegralBinStep(column) ? 1 : 0, + maxbins: { signal: maxbinsSignalName } + }; + const dataSequence = { + name: domainDataName, + transform: [ + { + type: "sequence", + start: { signal: `${binSignal}.start` }, + stop: { signal: `${binSignal}.stop` }, + step: { signal: `${binSignal}.step` } + }, + { + type: "formula", + expr: "datum.data", + as: field + }, + { + type: "formula", + expr: `datum.data + ${binSignal}.step`, + as: fieldEnd + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.start`, + as: FieldNames.First + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, + as: FieldNames.Last + }, + { + type: "filter", + expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify(FieldNames.First)}] : true` + } + ] + }; + const signals = [maxbinsSignal, { + name: dataExtentSpanSignal, + update: `${extentSignal}[1] - ${extentSignal}[0]` + }]; + if (imageSignal) signals.push(imageSignal); + return { + discreteColumn, + native: false, + transforms: [extentTransform, binTransform], + fields: [field, fieldEnd], + binSignal, + extentSignal, + dataSequence, + domainDataName, + signals, + fullScaleDataname: dataSequence.name + }; + } else return { + discreteColumn, + native: true, + fields: [column.name], + domainDataName, + fullScaleDataname: domainDataName + }; + } + function outerExtentSignal(name, min, max, dataExtent) { + return { + name, + update: `[min(${min}, ${dataExtent}[0]), max(${max}, ${dataExtent}[1])]` + }; + } + function shouldBeIntegralBinStep(column) { + return column.quantitative && column.type === "integer" && column.stats.max - column.stats.min <= 7; + } + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/band.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var bandScaleLinearSuffix = "_linear"; + var Band$1 = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `band_${this.id}`; + this.names = { + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + bandWidth: `${p}_bandwidth`, + accumulative: `${p}_accumulative` + }; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); + } + getGrouping() { + return this.bin.fields; + } + build() { + const { bin, names, props } = this; + const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; + const binField = bin.fields[0]; + if (bin.native === false) { + addSignals(globalScope.scope, ...bin.signals); + addTransforms(globalScope.data, ...bin.transforms); + addData(globalScope.scope, bin.dataSequence); + } + addData(globalScope.scope, { + name: names.accumulative, + source: bin.fullScaleDataname, + transform: [{ + type: "aggregate", + groupby: this.getGrouping().map(safeFieldName), + ops: ["count"] + }] + }); + const horizontal = orientation === "horizontal"; + modifySignal(horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth, "max", `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); + addSignals(globalScope.scope, { + name: names.bandWidth, + update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` + }); + const scale = this.getScale(bin, horizontal); + if (props.outerSignalExtents && bin.native === false) addScales(globalScope.scope, linearScale(scale.name + bandScaleLinearSuffix, { signal: bin.extentSignal }, scale.range, scale.reverse, false, false)); + let encodingRuleMap; + if (!props.excludeEncodingRuleMap) encodingRuleMap = horizontal ? { + x: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.x + }], + width: [{ + test: testForCollapseSelection(), + value: 0 + }] + } : { + y: [{ + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.offsets.h) + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + }; + return { + offsets: this.getOffset(horizontal, binField), + sizeSignals: horizontal ? { + layoutHeight: names.bandWidth, + layoutWidth: parentScope.sizeSignals.layoutWidth + } : { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: names.bandWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? void 0 : [scale], + y: horizontal ? [scale] : void 0 + } + }, + encodingRuleMap + }; + } + getOffset(horizontal, binField) { + const { names, props } = this; + const { parentScope } = props; + return { + x: addOffsets(parentScope.offsets.x, horizontal ? "" : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), + y: addOffsets(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ""), + h: horizontal ? names.bandWidth : parentScope.offsets.h, + w: horizontal ? parentScope.offsets.w : names.bandWidth + }; + } + getScale(bin, horizontal) { + const { names } = this; + const { parentScope } = this.props; + const binField = safeFieldName(bin.fields[0]); + let bandScale; + if (horizontal) bandScale = { + type: "band", + name: names.yScale, + range: [0, { signal: parentScope.sizeSignals.layoutHeight }], + padding: .1, + domain: { + data: bin.domainDataName, + field: binField, + sort: true + }, + reverse: true + }; + else bandScale = { + type: "band", + name: names.xScale, + range: [0, { signal: parentScope.sizeSignals.layoutWidth }], + padding: .1, + domain: { + data: bin.domainDataName, + field: binField, + sort: true + } + }; + return bandScale; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/facetSearch.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function displayBin(bin) { + const val = (index) => `datum[${JSON.stringify(bin.fields[index])}]`; + return bin.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); + } + function obj(nameValues, clause) { + if (clause) nameValues = [clause, ...nameValues]; + return `{${nameValues.join()}}`; + } + function serializeAsVegaExpression(bin, firstFieldName, lastFieldName, clause) { + if (bin.discreteColumn.column.quantitative) { + const low = [ + `name:${JSON.stringify(bin.discreteColumn.column.name)}`, + "operator:'>='", + `value:datum[${JSON.stringify(bin.fields[0])}]` + ]; + const high = [ + "clause:'&&'", + `name:${JSON.stringify(bin.discreteColumn.column.name)}`, + "operator:'<'", + `value:datum[${JSON.stringify(bin.fields[1])}]` + ]; + return obj([`expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]`], clause); + } else return obj([`expressions:[${obj([ + `name:${JSON.stringify(bin.discreteColumn.column.name)}`, + "operator:'=='", + `value:datum[${JSON.stringify(bin.fields[0])}]` + ])}]`], clause); + } + //#endregion + //#region ../sanddance-specs/dist/es6/ordinal.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function createOrdinals(source, prefix, binFields, sortOrder) { + const _binFields = binFields.map(safeFieldName); + const dataName = `${prefix}_bin_order`; + return { + data: { + name: dataName, + source, + transform: [ + { + type: "aggregate", + groupby: _binFields + }, + { + type: "collect", + sort: { + field: _binFields, + order: _binFields.map((f) => sortOrder) + } + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + } + ] + }, + scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) + }; + } + function ordinalScale(dataName, scaleName, binFields) { + return { + type: "ordinal", + name: scaleName, + domain: { + data: dataName, + field: safeFieldName(binFields[0]) + }, + range: { + data: dataName, + field: FieldNames.Ordinal + } + }; + } + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/cross.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cross$1 = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `cross_${this.id}`; + this.binX = binnable(`${p}_x`, props.globalScope.data.name, props.groupbyX); + this.binY = binnable(`${p}_y`, props.globalScope.data.name, props.groupbyY); + this.names = { + facetDataName: `data_${p}_facet`, + searchUnion: `data_${p}_search`, + dimScale: `scale_${p}`, + dimCount: `${p}_count`, + dimCategorical: `data_${p}_cat`, + dimCellSize: `${p}_cell_size`, + dimCellSizeCalc: `${p}_cell_calc` + }; + } + getGrouping() { + return this.binX.fields.concat(this.binY.fields); + } + build() { + const { binX, binY, names, prefix, props } = this; + const { axisTextColor, colRowTitles, globalScope, parentScope } = props; + const titles = { + x: { + dataName: null, + quantitative: null + }, + y: { + dataName: null, + quantitative: null + } + }; + const dx = { + dim: "x", + bin: binX, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutWidth, + layout: parentScope.sizeSignals.layoutWidth, + min: globalScope.signals.minCellWidth.name, + out: globalScope.signals.plotWidthOut, + offset: SignalNames.FacetPaddingLeft, + padding: SignalNames.FacetPaddingLeft, + dataOut: null, + scaleName: null, + position: null + }; + const dy = { + dim: "y", + bin: binY, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutHeight, + layout: parentScope.sizeSignals.layoutHeight, + min: globalScope.signals.minCellHeight.name, + out: globalScope.signals.plotHeightOut, + offset: SignalNames.FacetPaddingTop, + padding: `(${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})`, + dataOut: null, + scaleName: null, + position: null + }; + [dx, dy].forEach((d) => { + const { bin, dim, padding, sortOrder } = d; + let data; + let dataName; + let countSignal; + let scale; + const titleSource = titles[dim]; + if (bin.native === false) { + addSignals(globalScope.scope, ...bin.signals); + addTransforms(globalScope.data, ...bin.transforms); + addData(globalScope.scope, bin.dataSequence); + addTransforms(bin.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, + as: FieldNames.Contains + }); + data = bin.dataSequence; + dataName = bin.dataSequence.name; + countSignal = `length(data(${JSON.stringify(dataName)}))`; + scale = ordinalScale(dataName, `${names.dimScale}_${dim}`, bin.fields); + titleSource.dataName = bin.dataSequence.name; + } else { + dataName = globalScope.markDataName; + const ord = createOrdinals(dataName, `${prefix}_${dim}`, bin.fields, sortOrder); + data = ord.data; + addData(globalScope.scope, ord.data); + countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; + scale = ord.scale; + titleSource.dataName = ord.data.name; + } + titleSource.quantitative = bin.discreteColumn.column.quantitative; + d.dataOut = data; + d.scaleName = scale.name; + addTransforms(data, { + type: "formula", + expr: serializeAsVegaExpression(bin, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch + }, { + type: "formula", + expr: displayBin(bin), + as: FieldNames.FacetTitle + }); + addScales(globalScope.scope, scale); + const count = `${names.dimCount}_${dim}`; + const calc = `${names.dimCellSizeCalc}_${dim}`; + const size = `${names.dimCellSize}_${dim}`; + addSignals(globalScope.scope, { + name: count, + update: countSignal + }); + addSignals(globalScope.scope, { + name: calc, + update: `${d.layout} / ${count}` + }, { + name: size, + update: `max(${d.min}, (${calc} - ${padding}))` + }); + modifySignal(d.out, "max", `((${size} + ${padding}) * ${count})`); + d.position = this.dimensionOffset(d); + }); + const groupRow = { + type: "group", + encode: { update: { y: { signal: dy.position } } }, + from: { data: dy.dataOut.name }, + data: [{ + name: names.searchUnion, + source: dx.dataOut.name, + transform: [{ + type: "formula", + expr: `[datum[${JSON.stringify(FieldNames.FacetSearch)}], merge(parent[${JSON.stringify(FieldNames.FacetSearch)}], { clause: '&&'})]`, + as: FieldNames.FacetSearch + }] + }] + }; + const groupCol = { + style: "cell", + name: prefix, + type: "group", + encode: { update: { + height: { signal: `${names.dimCellSize}_y` }, + width: { signal: `${names.dimCellSize}_x` }, + x: { signal: dx.position } + } }, + from: { data: names.searchUnion } + }; + addMarks(globalScope.markGroup, groupRow); + addMarks(groupRow, groupCol); + const offsets = { + x: this.dimensionOffset(dx), + y: this.dimensionOffset(dy), + h: `${names.dimCellSize}_y`, + w: `${names.dimCellSize}_x` + }; + const sizeSignals = { + layoutHeight: `${names.dimCellSize}_y`, + layoutWidth: `${names.dimCellSize}_x`, + colCount: `${names.dimCount}_x`, + rowCount: `${names.dimCount}_y` + }; + if (colRowTitles) addFacetColRowTitles(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); + return { + facetScope: groupCol, + offsets, + sizeSignals, + titles + }; + } + dimensionOffset(d) { + const { names } = this; + return `${d.offset} + (scale(${JSON.stringify(d.scaleName)}, datum[${JSON.stringify(d.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d.dim} + ${d.padding})`; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/scatter.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Scatter$1 = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `scatter_${this.id}`; + this.names = { + aggregateData: `data_${p}_aggregate`, + markData: `data_${p}_mark`, + xDataExtent: `${p}_xDataExtent`, + yDataExtent: `${p}_yDataExtent`, + xExtent: `${p}_xExtent`, + yExtent: `${p}_yExtent`, + sizeExtent: `${p}_sizeExtent`, + sizeRange: `${p}_sizeRange`, + sizeScale: `${p}_sizeScale`, + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, prefix, props } = this; + const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x, y, z, zGrounded } = props; + const qsize = size && size.quantitative && size; + addSignals(globalScope.scope, { + name: SignalNames.PointScale, + value: 5, + bind: { + name: scatterPointScaleDisplay, + debounce: 250, + input: "range", + min: 1, + max: 10, + step: .1 + } + }, { + name: SignalNames.ZGrounded, + value: false, + bind: { + name: zGrounded, + input: "checkbox" + } + }); + if (backgroundImageExtents) { + addTransforms(globalScope.data, dataExtent(x, names.xDataExtent), dataExtent(y, names.yDataExtent)); + const xSignal = outerExtentSignal(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); + const ySignal = outerExtentSignal(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); + addSignals(globalScope.scope, xSignal, ySignal); + } + if (qsize) { + addTransforms(globalScope.data, { + type: "extent", + field: safeFieldName(qsize.name), + signal: names.sizeExtent + }); + addScales(globalScope.scope, { + name: names.sizeScale, + type: "pow", + exponent: .5, + domain: [0, { signal: `${names.sizeExtent}[1]` }], + range: [0, { signal: names.sizeRange }] + }); + addSignals(globalScope.scope, { + name: names.sizeRange, + update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / 20` + }); + } + addData(globalScope.scope, { + name: names.markData, + source: globalScope.markDataName, + transform: [ + x, + y, + z + ].map((c) => { + if (!c || !c.quantitative) return; + return { + type: "filter", + expr: `isValid(datum[${JSON.stringify(c.name)}])` + }; + }).filter(Boolean) + }); + globalScope.setMarkDataName(names.markData); + const globalScales = { + showAxes, + scales: {} + }; + const zValue = z ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z.name)}])` : null; + const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${SignalNames.PointScale}` : SignalNames.PointScale; + const update = Object.assign({ + height: [{ + test: testForCollapseSelection(), + value: 0 + }, { signal: sizeValueSignal }], + width: { signal: sizeValueSignal } + }, z && { + z: [{ + test: testForCollapseSelection(), + value: 0 + }, { signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` }], + zindex: [{ signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` }], + depth: [{ + test: testForCollapseSelection(), + value: 0 + }, { signal: view === "3d" ? `${SignalNames.ZGrounded} ? ${zValue} : ${sizeValueSignal}` : "0" }] + }); + [ + { + column: x, + xyz: "x", + scaleName: names.xScale, + domain: backgroundImageExtents ? { signal: names.xExtent } : { + data: globalScope.data.name, + field: safeFieldName(x.name) + }, + reverse: false, + signal: parentScope.sizeSignals.layoutWidth + }, + { + column: y, + xyz: "y", + scaleName: names.yScale, + domain: backgroundImageExtents ? { signal: names.yExtent } : { + data: globalScope.data.name, + field: safeFieldName(y.name) + }, + reverse: true, + signal: parentScope.sizeSignals.layoutHeight + }, + { + column: z, + xyz: "z", + scaleName: names.zScale, + domain: { + data: globalScope.data.name, + field: z ? safeFieldName(z.name) : null + }, + reverse: false, + signal: view === "3d" ? `(${globalScope.zSize}) * ${SignalNames.ZProportion}` : `10 * ${SignalNames.ZProportion}` + } + ].forEach((cs) => { + const { column, domain, reverse, scaleName, signal, xyz } = cs; + if (!column) return; + let scale; + if (column.quantitative) { + scale = linearScale(scaleName, domain, [0, { signal }], reverse, false, showAxes); + if (shouldBeIntegralBinStep(column)) scale.bins = { step: 1 }; + } else scale = pointScale(scaleName, globalScope.data.name, [0, { signal }], column.name, reverse); + globalScales.scales[xyz] = [scale]; + }); + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { update } + }; + addMarks(globalScope.markGroup, mark); + return { + offsets: { + x: addOffsets(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x.name)}])`), + y: addOffsets(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y.name)}]) - ${sizeValueSignal}`), + h: sizeValueSignal, + w: sizeValueSignal + }, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + globalScales, + mark, + encodingRuleMap: { y: [{ + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) + }] } + }; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/zBase.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addZScale(z, zSize, dataName, zScaleName) { + if (z) { + const zRange = [0, { signal: `(${zSize}) * ${SignalNames.ZProportion}` }]; + return z.quantitative ? linearScale(zScaleName, { + data: dataName, + field: safeFieldName(z.name) + }, zRange, false, true) : pointScale(zScaleName, dataName, zRange, z.name, false); + } + } + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/square.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Square = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `square_${this.id}`; + this.names = { + bandWidth: this.getBandWidth(), + maxGroupField: `${p}_max_group`, + maxGroupSignal: `${p}_max_grouping`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, prefix, props } = this; + const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + addTransforms(globalScope.data, Object.assign({ + type: "stack", + groupby: getGroupBy(groupings).map(safeFieldName), + as: [names.stack0, names.stack1] + }, sortBy && { sort: { + field: safeFieldName(sortBy.name), + order: "ascending" + } })); + const { gap, levelSize, size, squaresPerBand } = this.addSignals(); + const heightSignal = { signal: fillDirection === "down-right" ? size : levelSize }; + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { update: Object.assign({ + height: collapseYHeight ? [{ + test: testForCollapseSelection(), + value: 0 + }, heightSignal] : heightSignal, + width: { signal: fillDirection === "down-right" ? levelSize : size } + }, z && { + z: { value: 0 }, + depth: [{ + test: testForCollapseSelection(), + value: 0 + }, view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z.name) + } : { value: 0 }] + }) } + }; + addMarks(globalScope.markGroup, mark); + const { tx, ty } = this.transformXY(gap, levelSize, squaresPerBand); + return Object.assign(Object.assign(Object.assign({}, z && { globalScales: { + showAxes, + scales: { z: [zScale] } + } }), { + offsets: { + x: addOffsets(parentScope.offsets.x, tx.expr), + y: addOffsets(parentScope.offsets.y, ty.expr), + h: size, + w: size + }, + mark, + sizeSignals: { + layoutHeight: size, + layoutWidth: size + } + }), collapseYHeight && { encodingRuleMap: { y: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.y + }] } }); + } + getBandWidth() { + const { offsets } = this.props.parentScope; + switch (this.props.fillDirection) { + case "down-right": return offsets.h; + default: return offsets.w; + } + } + addSignals() { + const { names, props } = this; + const { fillDirection, globalScope, groupings, parentScope } = props; + let { maxGroupedFillSize, maxGroupedUnits } = props; + if (!maxGroupedUnits) if (groupings) { + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.maxGroupField] + }, { + type: "extent", + field: names.maxGroupField, + signal: names.maxGroupSignal + }); + maxGroupedUnits = `(${names.maxGroupSignal}[1])`; + } else maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; + if (!maxGroupedFillSize) maxGroupedFillSize = fillDirection === "down-right" ? parentScope.offsets.w : parentScope.offsets.h; + const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; + const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; + const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; + const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; + const levels = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; + return { + gap, + levelSize: `(((${maxGroupedFillSize}) / ${levels}) - ${gap})`, + size, + squaresPerBand + }; + } + transformXY(gap, levelSize, squaresPerBand) { + const { names, prefix } = this; + const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; + const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; + const { fillDirection, parentScope } = this.props; + const tx = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetX}` + }; + const ty = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetY}` + }; + switch (fillDirection) { + case "down-right": + tx.expr = `${level} * (${levelSize} + ${gap})`; + ty.expr = compartment; + break; + case "right-up": + tx.expr = compartment; + ty.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; + break; + default: + tx.expr = compartment; + ty.expr = `${level} * (${levelSize} + ${gap})`; + break; + } + return { + tx, + ty + }; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/stack.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Stack$1 = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `stack_${this.id}`; + this.names = { + cube: `${p}_cube`, + globalDataName: `data_${p}_count`, + globalExtent: `${p}_global_extent`, + levelDataName: `data_${p}_level`, + count: `${p}_count`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + sequence: `data_${p}_sequence`, + sides: `${p}_sides`, + size: `${p}_size`, + squared: `${p}_squared`, + maxCount: `${p}_maxCount`, + maxLevels: `${p}_maxLevels`, + zScale: `${p}_zScale` + }; + } + build() { + const { names, props } = this; + const { globalScope, groupings, parentScope, showAxes, sort } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.count] + }, { + type: "extent", + field: names.count, + signal: names.globalExtent + }, Object.assign({ + type: "stack", + groupby: getGroupBy(groupings).map(safeFieldName), + as: [names.stack0, names.stack1] + }, sort && { sort: { + field: safeFieldName(sort.name), + order: "ascending" + } })); + addData(globalScope.scope, { + name: names.sequence, + transform: [ + { + type: "sequence", + start: 1, + stop: { signal: `sqrt(${names.globalExtent}[1])` } + }, + { + type: "formula", + expr: "datum.data * datum.data", + as: "squared" + }, + { + type: "formula", + expr: `ceil(${names.globalExtent}[1] / datum.squared)`, + as: "maxlevels" + }, + { + type: "formula", + expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, + as: "side" + }, + { + type: "formula", + expr: "datum.side * datum.maxlevels + datum.maxlevels - 1", + as: "sidecubeheight" + }, + { + type: "formula", + expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, + as: "heightmatch" + }, + { + type: "collect", + sort: { + field: "heightmatch", + order: "ascending" + } + }, + { + type: "window", + ops: ["row_number"] + }, + { + type: "filter", + expr: "datum.row_number === 1" + } + ] + }); + addSignals(globalScope.scope, { + name: names.size, + update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` + }, { + name: names.squared, + update: `data('${names.sequence}')[0].squared` + }, { + name: names.sides, + update: `sqrt(${names.squared})` + }, { + name: names.cube, + update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` + }, { + name: names.maxLevels, + update: `data('${names.sequence}')[0].maxlevels` + }, { + name: names.maxCount, + update: `${names.maxLevels} * ${names.squared}` + }); + const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; + const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; + const cubeX = `(${layerOrdinal} % ${names.sides})`; + const cubeY = `floor(${layerOrdinal} / ${names.sides})`; + const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; + const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; + const offsets = { + x: addOffsets(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), + y: addOffsets(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), + h: names.size, + w: names.size + }; + const mark = { + type: "rect", + from: { data: this.names.levelDataName }, + encode: { update: { + z: { signal: `${zLevel} * (${names.cube} + 1)` }, + height: { signal: names.cube }, + width: { signal: names.cube }, + depth: { signal: names.cube } + } } + }; + addMarks(globalScope.markGroup, mark); + const zScale = { + type: "linear", + name: names.zScale, + domain: [0, { signal: names.maxCount }], + range: [0, { signal: `${names.maxLevels} * (${names.cube} + 1) - 1` }], + nice: false + }; + return { + offsets, + mark, + sizeSignals: { + layoutHeight: names.size, + layoutWidth: names.size + }, + globalScales: { + showAxes, + scales: { z: [zScale] } + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.y + }], + z: [{ + test: testForCollapseSelection(), + value: 0 + }], + depth: [{ + test: testForCollapseSelection(), + value: 0 + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/strip.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Strip = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `strip_${this.id}`; + this.names = { + firstField: `${p}${FieldNames.First}`, + lastField: `${p}${FieldNames.Last}`, + valueField: `${p}${FieldNames.Value}`, + scale: `scale_${p}`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, prefix, props } = this; + const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort, sortOrder, parentScope, view, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + const horizontal = orientation === "horizontal"; + const transform = []; + if (sort) transform.push({ + type: "collect", + sort: { + field: safeFieldName(sort.name), + order: sortOrder + } + }); + let stackField; + if (size) { + stackField = size.name; + transform.push({ + type: "filter", + expr: `datum[${JSON.stringify(size.name)}] > 0` + }); + } else { + stackField = names.valueField; + transform.push({ + type: "formula", + expr: "1", + as: stackField + }); + } + const stackTransform = { + type: "stack", + field: safeFieldName(stackField), + offset: "normalize", + as: [names.firstField, names.lastField] + }; + if (groupings.length) stackTransform.groupby = getGroupBy(groupings).map(safeFieldName); + transform.push(stackTransform); + addTransforms(globalScope.data, ...transform); + const span = [names.lastField, names.firstField].map((f) => `datum[${JSON.stringify(f)}]`).join(" - "); + const offsets = { + x: addOffsets(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ""), + y: addOffsets(parentScope.offsets.y, horizontal ? "" : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), + h: horizontal ? parentScope.offsets.h : `(${span}) * (${parentScope.offsets.h})`, + w: horizontal ? `(${span}) * (${parentScope.offsets.w})` : parentScope.offsets.w + }; + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { update: Object.assign({ + height: { signal: offsets.h }, + width: { signal: offsets.w } + }, z && { + z: { value: 0 }, + depth: [{ + test: testForCollapseSelection(), + value: 0 + }, view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z.name) + } : { value: 0 }] + }) } + }; + addMarks(globalScope.markGroup, mark); + let percentageScale; + if (addPercentageScale) percentageScale = [{ + type: "linear", + name: names.scale, + domain: [0, 100], + range: horizontal ? [0, { signal: parentScope.sizeSignals.layoutWidth }] : [{ signal: parentScope.sizeSignals.layoutHeight }, 0] + }]; + return { + globalScales: { + showAxes, + scales: { + x: horizontal ? percentageScale : void 0, + y: horizontal ? void 0 : percentageScale, + z: zScale && [zScale] + } + }, + offsets, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + mark + }; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/treemap.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Treemap$1 = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `treemap_${this.id}`; + this.names = { + dataName: `data_${p}`, + dataHeightWidth: `data_${p}_hw`, + dataExtents: `data_${p}_extents`, + dataFacet: `data_${p}_facet`, + dataFacetMark: `data_${p}_facetMark`, + fieldChildren: `${p}_children`, + fieldDepth: `${p}_depth`, + fieldX0: `${p}_x0`, + fieldX1: `${p}_x1`, + fieldY0: `${p}_y0`, + fieldY1: `${p}_y1`, + fieldHeight: `${p}_h`, + fieldWidth: `${p}_w`, + heightExtent: `${p}_heightExtent`, + widthExtent: `${p}_widthExtent`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, props } = this; + const { globalScope, parentScope, showAxes, treeMapMethod, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + const offsets = { + x: addOffsets(parentScope.offsets.x, fn(names.fieldX0)), + y: addOffsets(parentScope.offsets.y, fn(names.fieldY0)), + h: subtract$1(names.fieldY1, names.fieldY0), + w: subtract$1(names.fieldX1, names.fieldX0) + }; + const mark = this.transformedMark(offsets); + addSignals(globalScope.scope, { + name: SignalNames.TreeMapMethod, + value: "squarify", + bind: { + name: treeMapMethod, + input: "select", + options: ["squarify", "binary"] + } + }); + return Object.assign(Object.assign({}, z && { globalScales: { + showAxes, + scales: { z: [zScale] } + } }), { + mark, + offsets, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + } + }); + } + transformedMark(offsets) { + const { names, props } = this; + const { globalScope, groupings, parentScope } = props; + if (groupings.length) { + addData(globalScope.scope, { + name: names.dataHeightWidth, + source: globalScope.markDataName, + transform: [{ + type: "formula", + expr: parentScope.offsets.h, + as: names.fieldHeight + }, { + type: "formula", + expr: parentScope.offsets.w, + as: names.fieldWidth + }] + }); + const treemapData = { + name: names.dataFacetMark, + source: names.dataFacet + }; + const facets = { + type: "group", + from: { facet: { + name: names.dataFacet, + data: names.dataHeightWidth, + groupby: getGroupBy(groupings).map(safeFieldName) + } }, + data: [{ + name: names.dataExtents, + source: names.dataFacet, + transform: [{ + type: "extent", + field: names.fieldHeight, + signal: names.heightExtent + }, { + type: "extent", + field: names.fieldWidth, + signal: names.widthExtent + }] + }, treemapData] + }; + globalScope.setMarkDataName(names.dataFacetMark); + addMarks(globalScope.markGroup, facets); + globalScope.setMarkGroup(facets); + this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); + return this.addMark(offsets, facets, globalScope.markDataName); + } else { + this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); + return this.addMark(offsets, globalScope.markGroup, globalScope.markDataName); + } + } + addMark(offsets, markParent, markDataName) { + const { names, prefix, props } = this; + const { view, z } = props; + const mark = { + name: prefix, + type: "rect", + from: { data: markDataName }, + encode: { update: Object.assign({ + width: { signal: offsets.w }, + height: { signal: offsets.h } + }, z && { + z: { value: 0 }, + depth: [{ + test: testForCollapseSelection(), + value: 0 + }, view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z.name) + } : { value: 0 }] + }) } + }; + addMarks(markParent, mark); + return mark; + } + treemapTransform(treemapData, widthSignal, heightSignal) { + const { names, props } = this; + const { group, size } = props; + addTransforms(treemapData, { + type: "filter", + expr: `datum[${JSON.stringify(size.name)}] > 0` + }, { + type: "nest", + keys: [group && group.name || "__NONE__"] + }, { + type: "treemap", + field: safeFieldName(size.name), + sort: { + field: "value", + order: "descending" + }, + round: true, + method: { signal: SignalNames.TreeMapMethod }, + paddingInner: 1, + paddingOuter: 0, + size: [{ signal: widthSignal }, { signal: heightSignal }], + as: [ + names.fieldX0, + names.fieldY0, + names.fieldX1, + names.fieldY1, + names.fieldDepth, + names.fieldChildren + ] + }); + } + }; + function fn(n) { + return `datum[${JSON.stringify(n)}]`; + } + function subtract$1(...fields) { + return fields.map((n) => fn(n)).join(" - "); + } + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/wrap.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Wrap = class extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `wrap_${this.id}`; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby); + this.names = { + outputData: `data_${p}_out`, + rowColumnDataName: `data_${p}_row_col`, + cellHeight: `${p}_cellHeight`, + cellWidth: `${p}_cellWidth`, + fits: `${p}_fits`, + target: `${p}_target`, + minArea: `${p}_minArea`, + aspect: `${p}_aspect`, + minAspect: `${p}_minAspect`, + idealAspect: `${p}_idealAspect`, + dataLength: `${p}_dataLength`, + rxc0: `${p}_rxc0`, + rxc1: `${p}_rxc1`, + rxc2: `${p}_rxc2`, + rxc: `${p}_rxc`, + growColCount: `${p}_growColCount`, + growCellWidth: `${p}_growCellWidth`, + fitsArea: `${p}_fitsArea`, + colCount: `${p}_colCount` + }; + } + getGrouping() { + return this.bin.fields; + } + build() { + const { bin, names, prefix, props } = this; + const { axisTextColor, cellTitles, globalScope, parentScope } = props; + let ordinalBinData; + if (bin.native === false) { + addSignals(globalScope.scope, ...bin.signals); + addTransforms(globalScope.data, ...bin.transforms); + addData(globalScope.scope, bin.dataSequence); + addTransforms(bin.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, + as: FieldNames.Contains + }); + ordinalBinData = bin.dataSequence.name; + } else { + const ord = createOrdinals(globalScope.data.name, prefix, bin.fields, "ascending"); + addData(globalScope.scope, ord.data); + ordinalBinData = ord.data.name; + } + addData(globalScope.scope, { + name: names.rxc0, + transform: [{ + type: "sequence", + start: 1, + stop: { signal: `ceil(sqrt(${names.dataLength})) + 1` } + }, { + type: "formula", + expr: `ceil(${names.dataLength} / datum.data)`, + as: "complement" + }] + }, { + name: names.rxc1, + source: names.rxc0, + transform: [{ + type: "project", + fields: ["data"], + as: ["cols"] + }] + }, { + name: names.rxc2, + source: names.rxc0, + transform: [{ + type: "project", + fields: ["complement"], + as: ["cols"] + }] + }, { + name: names.rxc, + source: [names.rxc1, names.rxc2], + transform: [ + { + type: "formula", + expr: `ceil(${names.dataLength} / datum.cols)`, + as: "rows" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, + as: "cellw" + }, + { + type: "formula", + expr: `datum.cols === 1 ? max(datum.cellw, ${SignalNames.MinCellWidth}) : datum.cellw`, + as: "cellw" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, + as: "cellh" + }, + { + type: "formula", + expr: `datum.rows === 1 ? max(datum.cellh, ${SignalNames.MinCellHeight}) : datum.cellh`, + as: "cellh" + }, + { + type: "formula", + expr: `(datum.cellw >= ${SignalNames.MinCellWidth} && datum.cellh >= ${SignalNames.MinCellHeight})`, + as: "meetsmin" + }, + { + type: "filter", + expr: "datum.meetsmin" + }, + { + type: "formula", + expr: "datum.cellw / datum.cellh", + as: names.aspect + }, + { + type: "formula", + expr: `abs(datum.${names.aspect} - ${names.target})`, + as: names.idealAspect + }, + { + type: "formula", + expr: `${names.dataLength} / (datum.cols * datum.rows)`, + as: "coverage" + }, + { + type: "collect", + sort: { + field: [names.idealAspect, "coverage"], + order: ["ascending", "descending"] + } + } + ] + }, { + name: names.rowColumnDataName, + source: ordinalBinData, + transform: [ + { + type: "formula", + expr: `floor((datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) / ${names.colCount})`, + as: FieldNames.WrapRow + }, + { + type: "formula", + expr: `(datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) % ${names.colCount}`, + as: FieldNames.WrapCol + }, + { + type: "formula", + expr: serializeAsVegaExpression(bin, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch + }, + { + type: "formula", + expr: displayBin(bin), + as: FieldNames.FacetTitle + } + ] + }); + const dataOut = { + name: names.outputData, + source: globalScope.data.name, + transform: [{ + type: "lookup", + from: names.rowColumnDataName, + key: safeFieldName(bin.fields[0]), + fields: [bin.fields[0]].map(safeFieldName), + values: [FieldNames.WrapRow, FieldNames.WrapCol] + }] + }; + addData(globalScope.scope, dataOut); + globalScope.setMarkDataName(names.outputData); + addSignals(globalScope.scope, { + name: names.minAspect, + update: `${SignalNames.MinCellWidth} / ${SignalNames.MinCellHeight}` + }, { + name: names.target, + update: `${names.minAspect} === 1 ? 1.2 : ${names.minAspect}` + }, { + name: names.minArea, + update: `${SignalNames.MinCellWidth}*${SignalNames.MinCellHeight}` + }, { + name: names.aspect, + update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` + }, { + name: names.dataLength, + update: `data(${JSON.stringify(ordinalBinData)}).length` + }, { + name: names.growColCount, + update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${SignalNames.MinCellWidth}), 1)` + }, { + name: names.growCellWidth, + update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` + }, { + name: names.fitsArea, + update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` + }, { + name: names.fits, + update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` + }, { + name: names.colCount, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` + }, { + name: names.cellWidth, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` + }, { + name: names.cellHeight, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${SignalNames.MinCellHeight}` + }); + modifySignal(globalScope.signals.plotHeightOut, "max", `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); + modifySignal(globalScope.signals.plotWidthOut, "max", `(${names.cellWidth} * ${names.colCount})`); + const signalH = [ + names.cellHeight, + SignalNames.FacetPaddingTop, + SignalNames.FacetPaddingBottom + ].join(" - "); + const signalW = [names.cellWidth, SignalNames.FacetPaddingLeft].join(" - "); + const signalX = addOffsets(parentScope.offsets.x, `datum[${JSON.stringify(FieldNames.WrapCol)}] * ${names.cellWidth}`, SignalNames.FacetPaddingLeft); + const signalY = addOffsets(parentScope.offsets.y, `datum[${JSON.stringify(FieldNames.WrapRow)}] * ${names.cellHeight}`, SignalNames.FacetPaddingTop); + const update = { + height: { signal: signalH }, + width: { signal: signalW }, + x: { signal: signalX }, + y: { signal: signalY } + }; + const offsets = { + x: signalX, + y: signalY, + h: signalH, + w: signalW + }; + const group = { + style: "cell", + name: prefix, + type: "group", + from: { data: names.rowColumnDataName }, + encode: { update } + }; + addMarks(globalScope.markGroup, group); + const sizeSignals = { + layoutHeight: `(${names.cellHeight} - ${SignalNames.FacetPaddingTop} - ${SignalNames.FacetPaddingBottom})`, + layoutWidth: `(${names.cellWidth} - ${SignalNames.FacetPaddingLeft})`, + colCount: names.colCount, + rowCount: `ceil(${names.dataLength} / ${names.colCount})` + }; + if (cellTitles) addFacetCellTitles(group, sizeSignals, axisTextColor); + return { + facetScope: group, + sizeSignals, + offsets + }; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/layouts/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var layoutClasses = { + AggregateContainer, + AggregateSquare, + Band: Band$1, + Cross: Cross$1, + Scatter: Scatter$1, + Square, + Stack: Stack$1, + Strip, + Treemap: Treemap$1, + Wrap + }; + //#endregion + //#region ../sanddance-specs/dist/es6/image.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getImageMark(backgroundImage, allGlobalScales) { + const xScale = allGlobalScales.filter((s) => s.scales.x)[0].scales.x[0]; + const [xScaleName, yScaleName] = [xScale, allGlobalScales.filter((s) => s.scales.y)[0].scales.y[0]].map((s) => s.name + (xScale.type === "band" ? bandScaleLinearSuffix : "")); + return { + type: "image", + encode: { update: { + url: { value: backgroundImage.url }, + aspect: { value: false }, + baseline: { value: "bottom" }, + height: { signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) }, + y: { signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) }, + width: { signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) }, + x: { signal: getScaledValue(xScaleName, backgroundImage.extents.left) } + } } + }; + } + function getScaledSpan(scaleName, low, high) { + return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; + } + function getScaledValue(scaleName, value) { + return `scale('${scaleName}', ${value})`; + } + //#endregion + //#region ../sanddance-specs/dist/es6/specBuilder.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var SpecBuilder = class { + constructor(props, specContext) { + this.props = props; + this.specContext = specContext; + this.globalSignals = { + facetAxesAdjustX: { + name: SignalNames.FacetAxesAdjustX, + update: props.facetLayout && props.collapseFacetAxes ? 40 .toString() : "0" + }, + facetAxesAdjustY: { + name: SignalNames.FacetAxesAdjustY, + update: props.facetLayout && props.collapseFacetAxes ? 40 .toString() : "0" + }, + minCellWidth: { + name: SignalNames.MinCellWidth, + update: `140` + }, + minCellHeight: { + name: SignalNames.MinCellHeight, + update: `180` + }, + plotOffsetLeft: { + name: SignalNames.PlotOffsetLeft, + update: "0" + }, + plotOffsetTop: { + name: SignalNames.PlotOffsetTop, + update: "0" + }, + plotOffsetBottom: { + name: SignalNames.PlotOffsetBottom, + update: "0" + }, + plotOffsetRight: { + name: SignalNames.PlotOffsetRight, + update: "0" + }, + plotHeightOut: { + name: SignalNames.PlotHeightOut, + update: SignalNames.PlotHeightIn + }, + plotWidthOut: { + name: SignalNames.PlotWidthOut, + update: SignalNames.PlotWidthIn + } + }; + } + validate() { + const { specContext } = this; + const { specCapabilities } = this.props; + const { roles } = specCapabilities; + const required = roles.filter((r) => { + switch (typeof r.allowNone) { + case "boolean": return !r.allowNone; + case "undefined": return true; + case "function": return !r.allowNone(specContext); + } + }); + const numeric = roles.filter((r) => r.excludeCategoric); + const errors = required.map((r) => { + if (specContext.specColumns[r.role]) return null; + else return `Field ${r.role} is required.`; + }).concat(numeric.map((r) => { + if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) return `Field ${r.role} must be quantitative.`; + else return null; + })).filter(Boolean); + const { backgroundImage } = specContext.insight; + if (backgroundImage && !backgroundImage.extents) errors.push("BackgroundImage must have extents."); + return errors; + } + build() { + var _a, _b; + const { globalSignals, specContext } = this; + const { facetLayout, specCapabilities } = this.props; + const { insight, specColumns, specViewOptions } = specContext; + const dataName = "data_source"; + const { vegaSpec, groupMark } = this.initSpec(dataName); + const { topColorField, colorDataName } = addColor({ + scope: vegaSpec, + dataName, + specContext, + scaleName: ScaleNames.Color, + legendDataName: "data_legend", + topLookupName: "data_topcolorlookup", + colorReverseSignalName: SignalNames.ColorReverse + }); + const globalScope = new GlobalScope({ + dataName: colorDataName, + markGroup: groupMark, + scope: vegaSpec, + signals: globalSignals + }); + if (facetLayout) { + addSignals(vegaSpec, { + name: SignalNames.FacetPaddingBottom, + update: `${facetLayout.facetPadding.bottom}` + }, { + name: SignalNames.FacetPaddingLeft, + update: `${facetLayout.facetPadding.left}` + }, { + name: SignalNames.FacetPaddingTop, + update: `${facetLayout.facetPadding.top}` + }); + globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; + globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; + } + const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope) => { + if (facetLayout && i === 0) globalScope.zSize = innerScope.offsets.h; + }); + if (specResult) return specResult; + if (allGlobalScales.length > 0) { + const plotHeightOut = globalSignals.plotHeightOut.name; + const colTitleScale = { + type: "linear", + name: "scale_facet_col_title", + domain: [0, 1], + range: [0, { signal: globalSignals.plotWidthOut.name }] + }; + const rowTitleScale = { + type: "linear", + name: "scale_facet_row_title", + domain: [0, 1], + range: [{ signal: plotHeightOut }, 0] + }; + const facetScope = facetLayout ? firstScope : null; + const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; + if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative)) { + if (!backgroundGroup.marks) backgroundGroup.marks = []; + const imageMark = getImageMark(insight.backgroundImage, allGlobalScales); + backgroundGroup.marks.unshift(imageMark); + } + const axesScopes = facetLayout ? addFacetAxesGroupMarks({ + globalScope: globalScope.scope, + plotScope: groupMark, + facetScope, + colTitleScale, + rowTitleScale, + colSeqName: "data_FacetCellColTitles", + rowSeqName: "data_FacetCellRowTitles" + }) : { main: [{ + scope: groupMark, + lines: true, + labels: true, + title: true + }] }; + addGlobalAxes({ + globalScope, + allGlobalScales, + axisScales: this.props.axisScales, + plotOffsetSignals: { + x: globalSignals.plotOffsetLeft, + y: globalSignals.plotOffsetBottom + }, + axesOffsets: { + x: 120, + y: 120 + }, + axesTitlePadding: facetLayout ? { + x: 69, + y: 92 + } : { + x: 30, + y: 60 + }, + labelBaseline: { + x: "top", + y: "middle" + }, + specColumns, + specViewOptions, + axesScopes, + hideZAxis: !!facetLayout, + view: insight.view + }); + } + if (finalScope.mark) { + const { update } = finalScope.mark.encode; + const outputDataName = "output"; + finalScope.mark.from.data = outputDataName; + addData(globalScope.markGroup, { + name: outputDataName, + source: globalScope.markDataName, + transform: [{ + type: "formula", + expr: finalScope.offsets.x, + as: FieldNames.OffsetX + }, { + type: "formula", + expr: finalScope.offsets.y, + as: FieldNames.OffsetY + }] + }); + update.x = { field: FieldNames.OffsetX }; + update.y = { field: FieldNames.OffsetY }; + allEncodingRules.forEach((map) => { + for (const key in map) if (update[key]) { + const arrIn = map[key]; + if (!Array.isArray(update[key])) { + const value = update[key]; + const arrOut = []; + update[key] = arrOut; + arrIn.forEach((rule) => arrOut.push(rule)); + arrOut.push(value); + } else { + const arrOut = update[key]; + arrIn.forEach((rule) => arrOut.unshift(rule)); + } + } + }); + update.fill = fill$1(specContext, topColorField, ScaleNames.Color); + update.opacity = opacity(specContext); + } + return { + specCapabilities, + vegaSpec + }; + } + initSpec(dataName) { + const { globalSignals } = this; + const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; + const { specContext } = this; + const { insight } = specContext; + const groupMark = { + type: "group", + encode: { update: { + x: { signal: `${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, + y: { signal: SignalNames.PlotOffsetTop }, + height: { signal: `${SignalNames.PlotHeightOut} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: `${SignalNames.PlotWidthOut} + ${SignalNames.FacetAxesAdjustX}` } + } } + }; + const inputDataname = "input"; + return { + vegaSpec: { + $schema: "https://vega.github.io/schema/vega/v5.json", + data: [{ name: inputDataname }, { + name: dataName, + source: inputDataname, + transform: [] + }], + marks: [groupMark], + signals: textSignals(specContext, SignalNames.ViewportHeight).concat([ + minCellWidth, + minCellHeight, + { + name: SignalNames.ViewportHeight, + update: `max(${SignalNames.MinCellHeight}, ${insight.size.height})` + }, + { + name: SignalNames.ViewportWidth, + update: `max(${SignalNames.MinCellWidth}, ${insight.size.width})` + }, + plotOffsetLeft, + plotOffsetTop, + plotOffsetBottom, + plotOffsetRight, + facetAxesAdjustX, + facetAxesAdjustY, + { + name: SignalNames.PlotHeightIn, + update: `${SignalNames.ViewportHeight} - ${SignalNames.PlotOffsetBottom} + ${SignalNames.FacetAxesAdjustY}` + }, + { + name: SignalNames.PlotWidthIn, + update: `${SignalNames.ViewportWidth} - ${SignalNames.PlotOffsetLeft} - ${SignalNames.PlotOffsetRight}` + }, + plotHeightOut, + plotWidthOut, + { + name: "height", + update: `${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut} + ${SignalNames.PlotOffsetBottom} - ${SignalNames.FacetAxesAdjustY}` + }, + { + name: "width", + update: `${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotOffsetRight}` + } + ]) + }, + groupMark + }; + } + iterateLayouts(globalScope, onLayoutBuild) { + let specResult; + let parentScope = { + sizeSignals: globalScope.sizeSignals, + offsets: globalScope.offsets + }; + let firstScope; + let childScope; + const groupings = []; + const { layouts, specCapabilities } = this.props; + const allGlobalScales = []; + const allEncodingRules = []; + for (let i = 0; i < layouts.length; i++) { + if (!parentScope) continue; + const buildProps = { + globalScope, + parentScope, + axesScales: this.props.axisScales, + groupings, + id: i + }; + const layout = this.createLayout(layouts[i], buildProps); + try { + childScope = layout.build(); + childScope.id = i; + const groupby = layout.getGrouping(); + if (groupby) groupings.push({ + id: i, + groupby, + fieldOps: [{ + field: null, + op: "count", + as: FieldNames.Count + }] + }); + const sumOp = layout.getAggregateSumOp(); + if (sumOp) groupings[groupings.length - 1].fieldOps.push(sumOp); + onLayoutBuild(i, childScope); + } catch (e) { + specResult = { + errors: [e.stack], + specCapabilities, + vegaSpec: null + }; + break; + } + if (childScope && childScope.globalScales) allGlobalScales.push(childScope.globalScales); + if (childScope.encodingRuleMap) allEncodingRules.push(childScope.encodingRuleMap); + if (i === 0) firstScope = childScope; + parentScope = childScope; + } + return { + firstScope, + finalScope: parentScope, + specResult, + allGlobalScales, + allEncodingRules + }; + } + createLayout(layoutPair, buildProps) { + const { layoutType, props } = layoutPair; + const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); + const layoutClass = layoutClasses[layoutType]; + const layout = new layoutClass(layoutBuildProps); + layout.id = buildProps.id; + return layout; + } + }; + //#endregion + //#region ../sanddance-specs/dist/es6/build.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function build(specContext, currData) { + const { specColumns } = specContext; + inferAll([ + specColumns.color, + specColumns.facet, + specColumns.facetV, + specColumns.group, + specColumns.size, + specColumns.sort, + specColumns.x, + specColumns.y, + specColumns.z + ], currData); + const specBuilderProps = getSpecBuilderPropsForChart(specContext); + const specBuilder = new SpecBuilder(specBuilderProps, specContext); + let specResult; + if (specBuilder) { + try { + const errors = specBuilder.validate(); + if (errors.length) specResult = { + errors, + specCapabilities: specBuilderProps.specCapabilities, + vegaSpec: null + }; + else specResult = specBuilder.build(); + } catch (e) { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [e.stack] + }; + } + if (!specResult.errors) { + const data0 = specResult.vegaSpec.data[0]; + data0.values = currData; + } + } else specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [`could not build spec for ${specContext.insight.chart}`] + }; + return specResult; + } + //#endregion + //#region ../sanddance-specs/dist/es6/index.js + var es6_exports$5 = /* @__PURE__ */ __exportAll({ + ColorScaleNone: () => ColorScaleNone, + FieldNames: () => FieldNames, + Other: () => Other, + ScaleNames: () => ScaleNames, + SignalNames: () => SignalNames, + build: () => build, + getColumnsFromData: () => getColumnsFromData, + getSpecColumns: () => getSpecColumns, + getStats: () => getStats, + inferAll: () => inferAll + }); + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../sanddance/dist/es6/constants.js + var constants_exports = /* @__PURE__ */ __exportAll({ + ColorScaleNone: () => ColorScaleNone, + FieldNames: () => FieldNames, + GL_ORDINAL: () => GL_ORDINAL, + ScaleNames: () => ScaleNames, + SignalNames: () => SignalNames + }); + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var GL_ORDINAL = "GL_ORDINAL"; + //#endregion + //#region ../search-expression/dist/es6/group.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function isSearchExpressionGroup(search) { + if (!search) return false; + return !!search.expressions; + } + function createGroupFromExpression(input) { + return { expressions: [input] }; + } + function ensureSearchExpressionGroupArray(search) { + if (Array.isArray(search)) return [...search]; + else if (isSearchExpressionGroup(search)) return [search]; + else return [createGroupFromExpression(search)]; + } + //#endregion + //#region ../search-expression/dist/es6/compare.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var expressionKeys = Object.keys({ + clause: null, + name: null, + operator: null, + value: null + }); + function compareExpression(a, b) { + if (a && b) for (let k = 0; k < expressionKeys.length; k++) { + const key = expressionKeys[k]; + if (a[key] != b[key]) return false; + } + else return !a && !b; + return true; + } + var groupKeys = Object.keys({ clause: null }); + function compareGroup$1(a, b) { + for (let k = 0; k < groupKeys.length; k++) { + const key = groupKeys[k]; + if (a[key] != b[key]) return false; + } + if (!a.expressions && !b.expressions) return true; + if (!a.expressions || !b.expressions) return false; + if (a.expressions.length != b.expressions.length) return false; + for (let i = 0; i < a.expressions.length; i++) if (!compareExpression(a.expressions[i], b.expressions[i])) return false; + return true; + } + function compare$3(a, b) { + if (a == b) return true; + if (!a || !b) return false; + const [arrA, arrB] = [a, b].map(ensureSearchExpressionGroupArray); + if (arrA.length != arrB.length) return false; + for (let i = 0; i < arrA.length; i++) if (!compareGroup$1(arrA[i], arrB[i])) return false; + return true; + } + function startsWith(whole, part) { + if (!part) return true; + const [wholeArray, partArray] = [whole, part].map(ensureSearchExpressionGroupArray); + if (partArray.length > wholeArray.length) return false; + for (let i = 0; i < partArray.length; i++) if (!compareGroup$1(wholeArray[i], partArray[i])) return false; + return true; + } + //#endregion + //#region ../search-expression/dist/es6/exec.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function valueToBoolean(value) { + if (typeof value === "string") switch (value.toLowerCase()) { + case "true": return true; + case "false": return false; + } + return !!value; + } + function valueToString(value) { + if (value == null) return ""; + switch (typeof value) { + case "string": return value; + case "boolean": + case "number": return value.toString(); + } + return ""; + } + function isStringOperation(ex) { + switch (ex.operator) { + case "contains": + case "!contains": + case "starts": + case "!starts": return true; + } + return false; + } + function isnullorEmpty(value) { + if (value == null) return true; + if (typeof value === "string" && value.length === 0) return true; + return false; + } + var Exec = class { + constructor(search, columns) { + this.columns = columns; + this.groups = ensureSearchExpressionGroupArray(search).map((g) => { + const expressions = g.expressions.filter(Boolean); + expressions.forEach((ex) => { + ex.column = this.getColumn(ex.name); + ex.valueBool = valueToBoolean(ex.value); + ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); + ex.stringOperation = isStringOperation(ex); + }); + return Object.assign(Object.assign({}, g), { expressions }); + }); + } + getColumn(name) { + for (let i = 0; i < this.columns.length; i++) if (this.columns[i].name == name) return this.columns[i]; + } + runExpressionOnColumn(datum, ex) { + const actualDataValue = datum[ex.name]; + if (ex.operator === "isnullorEmpty") return isnullorEmpty(actualDataValue); + else if (ex.operator === "!isnullorEmpty") return !isnullorEmpty(actualDataValue); + let dataValue = actualDataValue; + let expressionValue = ex.value; + if (ex.column) { + if (ex.column.type === "string" || ex.stringOperation) { + dataValue = valueToString(actualDataValue).toLocaleLowerCase(); + expressionValue = ex.valueLow; + } else if (ex.column.type === "boolean") { + dataValue = valueToBoolean(actualDataValue); + expressionValue = ex.valueBool; + } else if (ex.column.quantitative) { + dataValue = +actualDataValue; + expressionValue = +ex.value; + } + } + switch (ex.operator) { + case "!=": return dataValue != expressionValue; + case "<": return dataValue < expressionValue; + case "<=": return dataValue <= expressionValue; + case "==": return dataValue == expressionValue; + case ">": return dataValue > expressionValue; + case ">=": return dataValue >= expressionValue; + case "contains": return dataValue.indexOf(expressionValue) >= 0; + case "!contains": return dataValue.indexOf(expressionValue) < 0; + case "starts": return dataValue.indexOf(expressionValue) == 0; + case "!starts": return dataValue.indexOf(expressionValue) !== 0; + } + } + runExpression(datum, ex) { + if (ex.name == null) { + const group = { expressions: this.columns.map((column, i) => { + const ex2 = Object.assign(Object.assign({}, ex), { + column, + name: column.name + }); + if (i) ex2.clause = "||"; + return ex2; + }) }; + return this.runGroup(datum, group); + } else return this.runExpressionOnColumn(datum, ex); + } + runGroup(datum, group) { + let accumulator = this.runExpression(datum, group.expressions[0]); + for (let i = 1; i < group.expressions.length; i++) { + const ex = group.expressions[i]; + switch (ex.clause) { + case "&&": + accumulator = accumulator && this.runExpression(datum, ex); + break; + case "||": + accumulator = accumulator || this.runExpression(datum, ex); + break; + } + } + return accumulator; + } + run(datum) { + let accumulator = this.runGroup(datum, this.groups[0]); + for (let i = 1; i < this.groups.length; i++) { + const group = this.groups[i]; + switch (group.clause) { + case "&&": + accumulator = accumulator && this.runGroup(datum, group); + break; + case "||": + accumulator = accumulator || this.runGroup(datum, group); + break; + } + } + return accumulator; + } + }; + //#endregion + //#region ../search-expression/dist/es6/invert.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function invertSearchExpressionGroup(input) { + const output = { expressions: input.expressions.map(invertSearchExpression) }; + if (input.clause) output.clause = invertedClauses[input.clause]; + return output; + } + var invertedOperators = { + "!=": "==", + "==": "!=", + "<": ">=", + ">=": "<", + "<=": ">", + ">": "<=", + "!contains": "contains", + "contains": "!contains", + "!isnullorEmpty": "isnullorEmpty", + "isnullorEmpty": "!isnullorEmpty", + "!starts": "starts", + "starts": "!starts" + }; + var invertedClauses = { + "&&": "||", + "||": "&&" + }; + function invertSearchExpression(input) { + const operator = invertedOperators[input.operator]; + const output = Object.assign(Object.assign({}, input), { operator }); + if (input.clause) output.clause = invertedClauses[input.clause]; + return output; + } + function invert$2(search) { + if (Array.isArray(search)) return search.map(invertSearchExpressionGroup); + else if (isSearchExpressionGroup(search)) return invertSearchExpressionGroup(search); + else return invertSearchExpression(search); + } + //#endregion + //#region ../search-expression/dist/es6/narrow.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function narrow(a, b) { + if (!a) return b; + const [arrA, arrB] = [a, b].map(ensureSearchExpressionGroupArray); + arrB[0].clause = "&&"; + return arrA.concat(arrB); + } + //#endregion + //#region ../search-expression/dist/es6/index.js + var es6_exports$4 = /* @__PURE__ */ __exportAll({ + Exec: () => Exec, + compare: () => compare$3, + compareExpression: () => compareExpression, + compareGroup: () => compareGroup$1, + createGroupFromExpression: () => createGroupFromExpression, + ensureSearchExpressionGroupArray: () => ensureSearchExpressionGroupArray, + invert: () => invert$2, + isSearchExpressionGroup: () => isSearchExpressionGroup, + narrow: () => narrow, + startsWith: () => startsWith + }); + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../sanddance/dist/es6/types.js + var types_exports$1 = /* @__PURE__ */ __exportAll({}); + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/tsx-create-element/dist/es6/index.js + var SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + /** + * Decamelizes a string with/without a custom separator (hyphen by default). + * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript + * + * @param str String in camelcase + * @param separator Separator for the new decamelized string. + */ + function decamelize(str, separator = "-") { + return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2").toLowerCase(); + } + function createElement(tag, attrs, ...children) { + if (typeof tag === "function") { + const fn = tag; + let props = attrs; + if (props === null || props === void 0) props = { children }; + else props.children = children; + return fn(props); + } else { + const ns = tag === "svg" ? SVG_NAMESPACE : null; + const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); + const map = attrs; + let ref; + for (let name in map) if (name && map.hasOwnProperty(name)) { + let value = map[name]; + if (name === "className" && value !== void 0) setAttribute$1(el, ns, "class", value.toString()); + else if (name === "disabled" && !value) {} else if (value === null || value === void 0) continue; + else if (value === true) setAttribute$1(el, ns, name, name); + else if (typeof value === "function") if (name === "ref") ref = value; + else el[name.toLowerCase()] = value; + else if (typeof value === "object") setAttribute$1(el, ns, name, flatten$1(value)); + else setAttribute$1(el, ns, name, value.toString()); + } + if (children && children.length > 0) appendChildren(el, children); + if (ref) ref(el); + return el; + } + } + function setAttribute$1(el, ns, name, value) { + if (ns) el.setAttributeNS(null, name, value); + else el.setAttribute(name, value); + } + function flatten$1(o) { + const arr = []; + for (let prop in o) arr.push(`${decamelize(prop, "-")}:${o[prop]}`); + return arr.join(";"); + } + function isInsideForeignObject(element) { + let current = element; + while (current) { + if (current.tagName.toLowerCase() === "foreignobject") return true; + current = current.parentElement; + } + return false; + } + function recreateWithSvgNamespace(element) { + const svgElement = document.createElementNS(SVG_NAMESPACE, element.tagName.toLowerCase()); + for (let i = 0; i < element.attributes.length; i++) { + const attr = element.attributes[i]; + svgElement.setAttributeNS(null, attr.name, attr.value); + } + for (const prop of [ + "onclick", + "onmousedown", + "onmouseup", + "onmouseover", + "onmouseout", + "onmousemove", + "onkeydown", + "onkeyup", + "onkeypress", + "onfocus", + "onblur" + ]) if (element[prop]) svgElement[prop] = element[prop]; + for (let i = 0; i < element.childNodes.length; i++) { + const child = element.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) svgElement.appendChild(recreateWithSvgNamespace(child)); + else svgElement.appendChild(child.cloneNode(true)); + } + return svgElement; + } + function addChild(parentElement, child) { + if (child === null || child === void 0 || typeof child === "boolean") return; + else if (Array.isArray(child)) appendChildren(parentElement, child); + else if (isElement(child)) { + const childEl = child; + if (parentElement.namespaceURI === SVG_NAMESPACE && childEl.namespaceURI !== SVG_NAMESPACE && childEl.tagName.toLowerCase() !== "foreignobject" && !isInsideForeignObject(parentElement)) { + const recreated = recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } else parentElement.appendChild(childEl); + } else parentElement.appendChild(document.createTextNode(child.toString())); + } + function appendChildren(parentElement, children) { + children.forEach((child) => addChild(parentElement, child)); + } + function isElement(el) { + return !!el.nodeType; + } + function mount(element, container) { + container.innerHTML = ""; + if (element) addChild(container, element); + } + function findElementByChildPositions(childPositions, container) { + let element = container || document.body; + let childPosition; + while (element && childPositions.length) { + childPosition = childPositions.shift(); + element = element.children.item(childPosition); + } + if (element) return element; + } + function focusActiveElement(element, activeElementInfo) { + element.focus(); + element.scrollTop = activeElementInfo.scrollTop; + const input = element; + if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); + } + function setActiveElement(activeElementInfo, container) { + if (activeElementInfo) { + const element = findElementByChildPositions(activeElementInfo.childPositions, container); + if (element) focusActiveElement(element, activeElementInfo); + } + } + function getActiveElementInfo(container) { + let element = document.activeElement; + const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element; + const activeElementInfo = { + childPositions: [], + scrollTop, + selectionDirection, + selectionEnd, + selectionStart + }; + while (element && element !== document.body && element !== container) { + activeElementInfo.childPositions.unshift(getChildPosition(element)); + element = element.parentElement; + } + if ((element === document.body || element === container) && activeElementInfo.childPositions.length) return activeElementInfo; + } + function getChildPosition(element) { + let childPosition = 0; + while (element = element.previousElementSibling) childPosition++; + return childPosition; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/controls.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var KeyCodes$2 = { ENTER: "Enter" }; + var Table$1 = (props) => { + return createElement("table", { className: props.className }, props.children, props.rows.map((row, i) => createElement("tr", { + className: props.rowClassName || "", + onClick: (e) => props.onRowClick && props.onRowClick(e, i), + tabIndex: props.onRowClick ? 0 : -1, + onKeyUp: (e) => { + if (e.key === KeyCodes$2.ENTER && props.onRowClick) props.onRowClick(e, i); + } + }, row.cells.map((cell, i) => createElement("td", { + className: cell.className || "", + title: cell.title || "" + }, cell.content))))); + }; + //#endregion + //#region ../vega-morphcharts/dist/es6/exports/controls.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * This file is for external facing export only, do not use this for internal references, + * as it may cause circular dependencies in Rollup. + */ + var controls_exports$1 = /* @__PURE__ */ __exportAll({ Table: () => Table$1 }); + //#endregion + //#region ../../node_modules/gl-matrix/esm/common.js + /** + * Common utilities + * @module glMatrix + */ + var EPSILON$3 = 1e-6; + var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + /** + * Sets the type of array used when creating new vectors and matrices + * + * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array + */ + function setMatrixArrayType(type) { + ARRAY_TYPE = type; + } + Math.PI / 180; + 180 / Math.PI; + //#endregion + //#region ../../node_modules/gl-matrix/esm/mat3.js + /** + * 3x3 Matrix + * @module mat3 + */ + /** + * Creates a new identity mat3 + * + * @returns {mat3} a new 3x3 matrix + */ + function create$8() { + var out = new ARRAY_TYPE(9); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + } + out[0] = 1; + out[4] = 1; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param {mat3} out the receiving 3x3 matrix + * @param {ReadonlyMat4} a the source 4x4 matrix + * @returns {mat3} out + */ + function fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Create a new mat3 with the given values + * + * @param {Number} m00 Component in column 0, row 0 position (index 0) + * @param {Number} m01 Component in column 0, row 1 position (index 1) + * @param {Number} m02 Component in column 0, row 2 position (index 2) + * @param {Number} m10 Component in column 1, row 0 position (index 3) + * @param {Number} m11 Component in column 1, row 1 position (index 4) + * @param {Number} m12 Component in column 1, row 2 position (index 5) + * @param {Number} m20 Component in column 2, row 0 position (index 6) + * @param {Number} m21 Component in column 2, row 1 position (index 7) + * @param {Number} m22 Component in column 2, row 2 position (index 8) + * @returns {mat3} A new mat3 + */ + function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { + var out = new ARRAY_TYPE(9); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m10; + out[4] = m11; + out[5] = m12; + out[6] = m20; + out[7] = m21; + out[8] = m22; + return out; + } + /** + * Calculates a 3x3 matrix from the given quaternion + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyQuat} q Quaternion to create matrix from + * + * @returns {mat3} out + */ + function fromQuat$1(out, q) { + var x = q[0], y = q[1], z = q[2], w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + //#endregion + //#region ../../node_modules/gl-matrix/esm/mat4.js + /** + * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied. + * @module mat4 + */ + /** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ + function create$7() { + var out = new ARRAY_TYPE(16); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + } + out[0] = 1; + out[5] = 1; + out[10] = 1; + out[15] = 1; + return out; + } + /** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the source matrix + * @returns {mat4} out + */ + function copy$7(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * + * @param {Number} m00 Component in column 0, row 0 position (index 0) + * @param {Number} m01 Component in column 0, row 1 position (index 1) + * @param {Number} m02 Component in column 0, row 2 position (index 2) + * @param {Number} m03 Component in column 0, row 3 position (index 3) + * @param {Number} m10 Component in column 1, row 0 position (index 4) + * @param {Number} m11 Component in column 1, row 1 position (index 5) + * @param {Number} m12 Component in column 1, row 2 position (index 6) + * @param {Number} m13 Component in column 1, row 3 position (index 7) + * @param {Number} m20 Component in column 2, row 0 position (index 8) + * @param {Number} m21 Component in column 2, row 1 position (index 9) + * @param {Number} m22 Component in column 2, row 2 position (index 10) + * @param {Number} m23 Component in column 2, row 3 position (index 11) + * @param {Number} m30 Component in column 3, row 0 position (index 12) + * @param {Number} m31 Component in column 3, row 1 position (index 13) + * @param {Number} m32 Component in column 3, row 2 position (index 14) + * @param {Number} m33 Component in column 3, row 3 position (index 15) + * @returns {mat4} A new mat4 + */ + function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + var out = new ARRAY_TYPE(16); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m03; + out[4] = m10; + out[5] = m11; + out[6] = m12; + out[7] = m13; + out[8] = m20; + out[9] = m21; + out[10] = m22; + out[11] = m23; + out[12] = m30; + out[13] = m31; + out[14] = m32; + out[15] = m33; + return out; + } + /** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ + function identity$4(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the source matrix + * @returns {mat4 | null} out, or null if source matrix is not invertible + */ + function invert$1(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) return null; + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Multiplies two mat4s + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the first operand + * @param {ReadonlyMat4} b the second operand + * @returns {mat4} out + */ + function multiply$2(out, a, b) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the matrix to translate + * @param {ReadonlyVec3} v vector to translate by + * @returns {mat4} out + */ + function translate$2(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + var a00, a01, a02, a03; + var a10, a11, a12, a13; + var a20, a21, a22, a23; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; + a01 = a[1]; + a02 = a[2]; + a03 = a[3]; + a10 = a[4]; + a11 = a[5]; + a12 = a[6]; + a13 = a[7]; + a20 = a[8]; + a21 = a[9]; + a22 = a[10]; + a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the mat4 by the dimensions in the given vec3 not using vectorization + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the matrix to scale + * @param {ReadonlyVec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ + function scale$6(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * + * @param {mat4} out mat4 receiving operation result + * @param {ReadonlyVec3} v Scaling vector + * @returns {mat4} out + */ + function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * let quatMat = mat4.create(); + * mat4.fromQuat(quatMat, quat); + * mat4.multiply(dest, dest, quatMat); + * mat4.scale(dest, dest, scale) + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Rotation quaternion + * @param {ReadonlyVec3} v Translation vector + * @param {ReadonlyVec3} s Scaling vector + * @returns {mat4} out + */ + function fromRotationTranslationScale(out, q, v, s) { + var x = q[0], y = q[1], z = q[2], w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * mat4.translate(dest, dest, origin); + * let quatMat = mat4.create(); + * mat4.fromQuat(quatMat, quat); + * mat4.multiply(dest, dest, quatMat); + * mat4.scale(dest, dest, scale) + * mat4.translate(dest, dest, negativeOrigin); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Rotation quaternion + * @param {ReadonlyVec3} v Translation vector + * @param {ReadonlyVec3} s Scaling vector + * @param {ReadonlyVec3} o The origin vector around which to scale and rotate + * @returns {mat4} out + */ + function fromRotationTranslationScaleOrigin(out, q, v, s, o) { + var x = q[0], y = q[1], z = q[2], w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + var ox = o[0]; + var oy = o[1]; + var oz = o[2]; + var out0 = (1 - (yy + zz)) * sx; + var out1 = (xy + wz) * sx; + var out2 = (xz - wy) * sx; + var out4 = (xy - wz) * sy; + var out5 = (1 - (xx + zz)) * sy; + var out6 = (yz + wx) * sy; + var out8 = (xz + wy) * sz; + var out9 = (yz - wx) * sz; + var out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * + * @param {mat4} out mat4 receiving operation result + * @param {ReadonlyQuat} q Quaternion to create matrix from + * + * @returns {mat4} out + */ + function fromQuat(out, q) { + var x = q[0], y = q[1], z = q[2], w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ + function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near * 2 * nf; + out[15] = 0; + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum, can be null or Infinity + * @returns {mat4} out + */ + function perspectiveNO(out, fovy, aspect, near, far) { + var f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link mat4.perspectiveNO} + * @function + */ + var perspective = perspectiveNO; + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. + * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {ReadonlyVec3} eye Position of the viewer + * @param {ReadonlyVec3} center Point the viewer is looking at + * @param {ReadonlyVec3} up vec3 pointing up + * @returns {mat4} out + */ + function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var centerx = center[0]; + var centery = center[1]; + var centerz = center[2]; + if (Math.abs(eyex - centerx) < 1e-6 && Math.abs(eyey - centery) < 1e-6 && Math.abs(eyez - centerz) < 1e-6) return identity$4(out); + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Alias for {@link mat4.multiply} + * @function + */ + var mul = multiply$2; + //#endregion + //#region ../../node_modules/gl-matrix/esm/vec3.js + /** + * 3 Dimensional Vector + * @module vec3 + */ + /** + * Creates a new, empty vec3 + * + * @returns {vec3} a new 3D vector + */ + function create$6() { + var out = new ARRAY_TYPE(3); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + return out; + } + /** + * Creates a new vec3 initialized with values from an existing vector + * + * @param {ReadonlyVec3} a vector to clone + * @returns {vec3} a new 3D vector + */ + function clone$4(a) { + var out = new ARRAY_TYPE(3); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Calculates the length of a vec3 + * + * @param {ReadonlyVec3} a vector to calculate length of + * @returns {Number} length of a + */ + function length$1(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Creates a new vec3 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} a new 3D vector + */ + function fromValues$3(x, y, z) { + var out = new ARRAY_TYPE(3); + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Copy the values from one vec3 to another + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the source vector + * @returns {vec3} out + */ + function copy$6(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * + * @param {vec3} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} out + */ + function set$8(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function add$4(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Multiplies two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function multiply$1(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Returns the minimum of two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function min$3(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function max$3(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * Scales a vec3 by a scalar number + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to scale + * @param {Number} b amount to scale the vector by + * @returns {vec3} out + */ + function scale$5(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @param {Number} scale the amount to scale b by before adding + * @returns {vec3} out + */ + function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the euclidian distance between two vec3's + * + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {Number} distance between a and b + */ + function distance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {Number} squared distance between a and b + */ + function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Calculates the squared length of a vec3 + * + * @param {ReadonlyVec3} a vector to calculate squared length of + * @returns {Number} squared length of a + */ + function squaredLength(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return x * x + y * y + z * z; + } + /** + * Negates the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a vector to negate + * @returns {vec3} out + */ + function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Normalize a vec3 + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a vector to normalize + * @returns {vec3} out + */ + function normalize$5(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var len = x * x + y * y + z * z; + if (len > 0) len = 1 / Math.sqrt(len); + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {Number} dot product of a and b + */ + function dot$1(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function cross$1(out, a, b) { + var ax = a[0], ay = a[1], az = a[2]; + var bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {vec3} out + */ + function lerp$1(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to transform + * @param {ReadonlyMat4} m matrix to transform with + * @returns {vec3} out + */ + function transformMat4$2(out, a, m) { + var x = a[0], y = a[1], z = a[2]; + var w = m[3] * x + m[7] * y + m[11] * z + m[15]; + w = w || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to transform + * @param {ReadonlyMat3} m the 3x3 matrix to transform with + * @returns {vec3} out + */ + function transformMat3(out, a, m) { + var x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to transform + * @param {ReadonlyQuat} q normalized quaternion to transform with + * @returns {vec3} out + */ + function transformQuat(out, a, q) { + var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; + var vx = a[0], vy = a[1], vz = a[2]; + var tx = qy * vz - qz * vy; + var ty = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + tx = tx + tx; + ty = ty + ty; + tz = tz + tz; + out[0] = vx + qw * tx + qy * tz - qz * ty; + out[1] = vy + qw * ty + qz * tx - qx * tz; + out[2] = vz + qw * tz + qx * ty - qy * tx; + return out; + } + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {ReadonlyVec3} a The first vector. + * @param {ReadonlyVec3} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function exactEquals$1(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {ReadonlyVec3} a The first vector. + * @param {ReadonlyVec3} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function equals$2(a, b) { + var a0 = a[0], a1 = a[1], a2 = a[2]; + var b0 = b[0], b1 = b[1], b2 = b[2]; + return Math.abs(a0 - b0) <= 1e-6 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= 1e-6 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= 1e-6 * Math.max(1, Math.abs(a2), Math.abs(b2)); + } + /** + * Alias for {@link vec3.length} + * @function + */ + var len = length$1; + (function() { + var vec = create$6(); + return function(a, stride, offset, count, fn, arg) { + var i, l; + if (!stride) stride = 3; + if (!offset) offset = 0; + if (count) l = Math.min(count * stride + offset, a.length); + else l = a.length; + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + } + return a; + }; + })(); + //#endregion + //#region ../../node_modules/gl-matrix/esm/vec4.js + /** + * 4 Dimensional Vector + * @module vec4 + */ + /** + * Creates a new, empty vec4 + * + * @returns {vec4} a new 4D vector + */ + function create$5() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + } + return out; + } + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param {ReadonlyVec4} a vector to clone + * @returns {vec4} a new 4D vector + */ + function clone$3(a) { + var out = new ARRAY_TYPE(4); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a new vec4 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {vec4} a new 4D vector + */ + function fromValues$2(x, y, z, w) { + var out = new ARRAY_TYPE(4); + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Copy the values from one vec4 to another + * + * @param {vec4} out the receiving vector + * @param {ReadonlyVec4} a the source vector + * @returns {vec4} out + */ + function copy$5(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a vec4 to the given values + * + * @param {vec4} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {vec4} out + */ + function set$7(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Normalize a vec4 + * + * @param {vec4} out the receiving vector + * @param {ReadonlyVec4} a vector to normalize + * @returns {vec4} out + */ + function normalize$4(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + var len = x * x + y * y + z * z + w * w; + if (len > 0) len = 1 / Math.sqrt(len); + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two vec4's + * + * @param {ReadonlyVec4} a the first operand + * @param {ReadonlyVec4} b the second operand + * @returns {Number} dot product of a and b + */ + function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Transforms the vec4 with a mat4. + * + * @param {vec4} out the receiving vector + * @param {ReadonlyVec4} a the vector to transform + * @param {ReadonlyMat4} m matrix to transform with + * @returns {vec4} out + */ + function transformMat4$1(out, a, m) { + var x = a[0], y = a[1], z = a[2], w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {ReadonlyVec4} a The first vector. + * @param {ReadonlyVec4} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + (function() { + var vec = create$5(); + return function(a, stride, offset, count, fn, arg) { + var i, l; + if (!stride) stride = 4; + if (!offset) offset = 0; + if (count) l = Math.min(count * stride + offset, a.length); + else l = a.length; + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + vec[3] = a[i + 3]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + a[i + 3] = vec[3]; + } + return a; + }; + })(); + //#endregion + //#region ../../node_modules/gl-matrix/esm/quat.js + /** + * Quaternion in the format XYZW + * @module quat + */ + /** + * Creates a new identity quat + * + * @returns {quat} a new quaternion + */ + function create$4() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyVec3} axis the axis around which to rotate + * @param {Number} rad the angle in radians + * @returns {quat} out + **/ + function setAxisAngle(out, axis, rad) { + rad = rad * .5; + var s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Multiplies two quat's + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a the first operand + * @param {ReadonlyQuat} b the second operand + * @returns {quat} out + */ + function multiply(out, a, b) { + var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var bx = b[0], by = b[1], bz = b[2], bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * + * @param {quat} out quat receiving operation result + * @param {ReadonlyQuat} a quat to rotate + * @param {number} rad angle (in radians) to rotate + * @returns {quat} out + */ + function rotateX(out, a, rad) { + rad *= .5; + var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var bx = Math.sin(rad), bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * + * @param {quat} out quat receiving operation result + * @param {ReadonlyQuat} a quat to rotate + * @param {number} rad angle (in radians) to rotate + * @returns {quat} out + */ + function rotateY(out, a, rad) { + rad *= .5; + var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var by = Math.sin(rad), bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a the first operand + * @param {ReadonlyQuat} b the second operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {quat} out + */ + function slerp(out, a, b, t) { + var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var bx = b[0], by = b[1], bz = b[2], bw = b[3]; + var omega, cosom = ax * bx + ay * by + az * bz + aw * bw, sinom, scale0, scale1; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > 1e-6) { + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a quat to calculate conjugate of + * @returns {quat} out + */ + function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyMat3} m rotation matrix + * @returns {quat} out + * @function + */ + function fromMat3(out, m) { + var fTrace = m[0] + m[4] + m[8]; + var fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = .5 * fRoot; + fRoot = .5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + var i = 0; + if (m[4] > m[0]) i = 1; + if (m[8] > m[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = .5 * fRoot; + fRoot = .5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param {ReadonlyQuat} a quaternion to clone + * @returns {quat} a new quaternion + * @function + */ + var clone$2 = clone$3; + /** + * Creates a new quat initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {quat} a new quaternion + * @function + */ + var fromValues$1 = fromValues$2; + /** + * Copy the values from one quat to another + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a the source quaternion + * @returns {quat} out + * @function + */ + var copy$4 = copy$5; + /** + * Set the components of a quat to the given values + * + * @param {quat} out the receiving quaternion + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {quat} out + * @function + */ + var set$6 = set$7; + /** + * Normalize a quat + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a quaternion to normalize + * @returns {quat} out + * @function + */ + var normalize$3 = normalize$4; + /** + * Returns whether or not the quaternions point approximately to the same direction. + * + * Both quaternions are assumed to be unit length. + * + * @param {ReadonlyQuat} a The first unit quaternion. + * @param {ReadonlyQuat} b The second unit quaternion. + * @returns {Boolean} True if the quaternions are equal, false otherwise. + */ + function equals$1(a, b) { + return Math.abs(dot(a, b)) >= 1 - EPSILON$3; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param {quat} out the receiving quaternion. + * @param {ReadonlyVec3} a the initial vector + * @param {ReadonlyVec3} b the destination vector + * @returns {quat} out + */ + var rotationTo = function() { + var tmpvec3 = create$6(); + var xUnitVec3 = fromValues$3(1, 0, 0); + var yUnitVec3 = fromValues$3(0, 1, 0); + return function(out, a, b) { + var dot = dot$1(a, b); + if (dot < -.999999) { + cross$1(tmpvec3, xUnitVec3, a); + if (len(tmpvec3) < 1e-6) cross$1(tmpvec3, yUnitVec3, a); + normalize$5(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); + return out; + } else if (dot > .999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + cross$1(tmpvec3, a, b); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot; + return normalize$3(out, out); + } + }; + }(); + (function() { + var temp1 = create$4(); + var temp2 = create$4(); + return function(out, a, b, c, d, t) { + slerp(temp1, a, d, t); + slerp(temp2, b, c, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + })(); + (function() { + var matr = create$8(); + return function(out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize$3(out, fromMat3(out, matr)); + }; + })(); + //#endregion + //#region ../../node_modules/gl-matrix/esm/vec2.js + /** + * 2 Dimensional Vector + * @module vec2 + */ + /** + * Creates a new, empty vec2 + * + * @returns {vec2} a new 2D vector + */ + function create$3() { + var out = new ARRAY_TYPE(2); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + } + return out; + } + /** + * Creates a new vec2 initialized with values from an existing vector + * + * @param {ReadonlyVec2} a vector to clone + * @returns {vec2} a new 2D vector + */ + function clone$1(a) { + var out = new ARRAY_TYPE(2); + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Creates a new vec2 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @returns {vec2} a new 2D vector + */ + function fromValues(x, y) { + var out = new ARRAY_TYPE(2); + out[0] = x; + out[1] = y; + return out; + } + /** + * Copy the values from one vec2 to another + * + * @param {vec2} out the receiving vector + * @param {ReadonlyVec2} a the source vector + * @returns {vec2} out + */ + function copy$3(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a vec2 to the given values + * + * @param {vec2} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @returns {vec2} out + */ + function set$5(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Transforms the vec2 with a mat4 + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param {vec2} out the receiving vector + * @param {ReadonlyVec2} a the vector to transform + * @param {ReadonlyMat4} m matrix to transform with + * @returns {vec2} out + */ + function transformMat4(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {ReadonlyVec2} a The first vector. + * @param {ReadonlyVec2} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function equals(a, b) { + var a0 = a[0], a1 = a[1]; + var b0 = b[0], b1 = b[1]; + return Math.abs(a0 - b0) <= 1e-6 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= 1e-6 * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + (function() { + var vec = create$3(); + return function(a, stride, offset, count, fn, arg) { + var i, l; + if (!stride) stride = 2; + if (!offset) offset = 0; + if (count) l = Math.min(count * stride + offset, a.length); + else l = a.length; + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + } + return a; + }; + })(); + //#endregion + //#region ../../node_modules/morphcharts/dist/constants.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Constants$2 = class {}; + Constants$2.TWO_PI = 6.283185307179586; + Constants$2.PI = 3.141592653589793; + Constants$2.PI_OVER_TWO = 1.5707963267948966; + Constants$2.PI_OVER_THREE = 1.0471975511965976; + Constants$2.PI_OVER_FOUR = .7853981633974483; + Constants$2.PI_OVER_SIX = .5235987755982988; + Constants$2.LOG_2 = .6931471805599453; + Constants$2.RADIANS_PER_DEGREE = .017453292519943295; + Constants$2.DEGREES_PER_RADIAN = 57.29577951308232; + Constants$2.ROOT_TWO = 1.4142135623730951; + Constants$2.ROOT_TWO_OVER_TWO = .7071067811865476; + Constants$2.ROOT_THREE = 1.7320508075688772; + Constants$2.ROOT_THREE_OVER_TWO = .8660254037844386; + Constants$2.ROOT_THREE_OVER_THREE = .5773502691896257; + Constants$2.VECTOR2_ZERO = fromValues(0, 0); + Constants$2.VECTOR2_ONE = fromValues(1, 1); + Constants$2.VECTOR2_UNITX = fromValues(1, 0); + Constants$2.VECTOR2_UNITY = fromValues(0, 1); + Constants$2.VECTOR3_ZERO = fromValues$3(0, 0, 0); + Constants$2.VECTOR3_ONE = fromValues$3(1, 1, 1); + Constants$2.VECTOR3_UNITX = fromValues$3(1, 0, 0); + Constants$2.VECTOR3_UNITY = fromValues$3(0, 1, 0); + Constants$2.VECTOR3_UNITZ = fromValues$3(0, 0, 1); + Constants$2.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); + Constants$2.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); + Constants$2.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); + Constants$2.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); + Constants$2.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); + Constants$2.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); + Constants$2.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); + Constants$2.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); + Constants$2.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); + Constants$2.MAT3_IDENTITY = create$8(); + Constants$2.MAT4_IDENTITY = create$7(); + Constants$2.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + Constants$2.QUAT_IDENTITY = create$4(); + Constants$2.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants$2.ROOT_TWO_OVER_TWO, 0, 0, Constants$2.ROOT_TWO_OVER_TWO); + Constants$2.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants$2.ROOT_TWO_OVER_TWO, 0, 0, Constants$2.ROOT_TWO_OVER_TWO); + Constants$2.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants$2.ROOT_TWO_OVER_TWO, 0, Constants$2.ROOT_TWO_OVER_TWO); + Constants$2.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants$2.ROOT_TWO_OVER_TWO, 0, Constants$2.ROOT_TWO_OVER_TWO); + Constants$2.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO); + Constants$2.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO); + Constants$2.MILLISECONDS_PER_DAY = 864e5; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/math.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var MathHelper = class { + static simpleLinearRegression(points) { + const n = points.length; + let sumX = 0; + let sumY = 0; + let sumXY = 0; + let sumXX = 0; + for (let i = 0; i < n; i++) { + sumX += points[i].x; + sumY += points[i].y; + sumXY += points[i].x * points[i].y; + sumXX += points[i].x * points[i].x; + } + const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); + return { + slope, + yIntercept: (sumY - slope * sumX) / n + }; + } + static clamp(value, min, max) { + return Math.max(Math.min(value, max), min); + } + static lerp(value1, value2, amount) { + return value1 + (value2 - value1) * amount; + } + static normalize(value, min, max, from = 0, to = 1) { + return max - min == 0 ? 0 : Math.max(Math.min((to - from) * (value - min) / (max - min) + from, to), from); + } + static splitExponent(value, result) { + let exponent = Math.round(Math.log10(Math.abs(value))); + let coefficient = value / Math.pow(10, exponent); + if (coefficient < 1) { + coefficient *= 10; + exponent--; + } + result[0] = coefficient; + result[1] = exponent; + } + static combineExponent(mantissa, exponent) { + return mantissa * Math.pow(10, exponent); + } + static isPowerOf2(value) { + return (value & value - 1) == 0; + } + }; + var PseudoRandom = class { + constructor(seed) { + this._seed = seed % 2147483647; + if (this._seed <= 0) this._seed += 2147483646; + } + next() { + return this._seed = this._seed * 16807 % 2147483647; + } + nextFloat() { + return (this.next() - 1) / 2147483646; + } + nextInteger(min, max) { + return Math.floor(this.nextFloat() * (max - min + 1) + min); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/angle.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AngleHelper = class AngleHelper { + static degreesToRadians(degrees) { + return degrees * Constants$2.RADIANS_PER_DEGREE; + } + static radiansToDegrees(radians) { + return radians * Constants$2.DEGREES_PER_RADIAN; + } + static wrapAngle(angle) { + if (angle > Constants$2.PI) angle = angle - Constants$2.TWO_PI; + else if (angle < -Constants$2.PI) angle += Constants$2.TWO_PI; + return angle; + } + static sphericalToCartesian(altitude, longitude, latitude, result) { + latitude = AngleHelper.degreesToRadians(latitude); + longitude = AngleHelper.degreesToRadians(longitude); + const scale = Math.cos(latitude); + result[0] = altitude * scale * Math.sin(longitude); + result[1] = altitude * Math.sin(latitude); + result[2] = altitude * scale * Math.cos(longitude); + } + static cartesianToSpherical(x, y, z, result) { + result[0] = Math.atan2(x, z); + result[1] = Math.asin(y); + } + static angleBetweenVectors(from, to) { + if (exactEquals$1(from, to)) return 0; + else { + const dot = MathHelper.clamp(dot$1(from, to), -1, 1); + return Math.acos(dot); + } + } + static signedAngleBetweenVectors(from, to, up) { + if (exactEquals$1(from, to)) return 0; + else { + const dot = MathHelper.clamp(dot$1(from, to), -1, 1); + let angle = Math.acos(dot); + cross$1(AngleHelper._vec3, from, to); + if (dot$1(AngleHelper._vec3, up) < 0) angle = -angle; + return angle; + } + } + }; + AngleHelper._vec3 = create$6(); + //#endregion + //#region ../../node_modules/morphcharts/dist/cameras/camera.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var CameraBase = class { + getView(view) { + this.getPosition(view.position); + } + setView(view, isSmooth) { + this.setPosition(view.position, isSmooth); + } + lerpView(from, to, time) { + lerp$1(this._vec3, from.position, to.position, time); + this.setPosition(this._vec3, false); + } + get vMatrices() { + return this._vMatrices; + } + get inverseVMatrices() { + return this._inverseVMatrices; + } + get mvMatrices() { + return this._mvMatrices; + } + get pMatrices() { + return this._pMatrices; + } + get inversePMatrices() { + return this._inversePMatrices; + } + get pickVMatrix() { + return this._pickVMatrix; + } + get rMatrix() { + return this._mat3; + } + getOrbit(value) { + copy$4(value, this._orbitRotation); + } + setOrbit(value, isSmooth) { + copy$4(this._orbitRotation, value); + if (!isSmooth) copy$4(this._smoothedOrbitRotation, value); + } + getPosition(value) { + copy$6(value, this._cameraPosition); + } + setPosition(value, isSmooth) { + copy$6(this._cameraPosition, value); + if (!isSmooth) copy$6(this._smoothedCameraPosition, value); + } + constructor(core) { + this._core = core; + this._vec3 = create$6(); + this._quat = create$4(); + this._mat3 = create$8(); + this._right = create$6(); + this._up = create$6(); + this._forward = create$6(); + this._modelManipulationOrigin = create$6(); + this.modelPosition = create$6(); + this.modelScale = create$6(); + this.modelRotation = create$4(); + this._orbitRotation = create$4(); + this._orbitDirection = create$4(); + this._smoothedOrbitRotation = create$4(); + this._smoothedCameraPosition = create$6(); + this._smoothedCameraRotation = create$4(); + this._cameraPosition = create$6(); + this._cameraRotation = create$4(); + this._combinedPosition = create$6(); + this._combinedRotation = create$4(); + this._leftToRightEye = create$6(); + this._pickVMatrix = create$7(); + this._eyePositions = [create$6(), create$6()]; + this._vMatrices = [create$7(), create$7()]; + this._mvMatrices = [create$7(), create$7()]; + this._pMatrices = [create$7(), create$7()]; + this._inverseVMatrices = [create$7(), create$7()]; + this._inversePMatrices = [create$7(), create$7()]; + } + reset(isSmooth) { + copy$6(this._cameraPosition, Constants$2.VECTOR3_ZERO); + copy$4(this._cameraRotation, Constants$2.QUAT_IDENTITY); + copy$4(this._orbitRotation, Constants$2.QUAT_IDENTITY); + if (!isSmooth) this.syncSmooth(); + } + update(elapsedTime) { + let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); + lerp$1(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); + amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); + slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); + slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); + const epsilon = 1e-6; + let x; + let y; + let z; + let w; + x = this._smoothedCameraPosition[0] - this._cameraPosition[0]; + y = this._smoothedCameraPosition[1] - this._cameraPosition[1]; + z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; + if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon) copy$6(this._smoothedCameraPosition, this._cameraPosition); + x = this._smoothedCameraRotation[0] - this._cameraRotation[0]; + y = this._smoothedCameraRotation[1] - this._cameraRotation[1]; + z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; + w = this._smoothedCameraRotation[3] - this._cameraRotation[3]; + if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) copy$4(this._smoothedCameraRotation, this._cameraRotation); + x = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; + y = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; + z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; + w = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; + if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) copy$4(this._smoothedOrbitRotation, this._orbitRotation); + normalize$3(this._smoothedCameraRotation, this._smoothedCameraRotation); + normalize$3(this._smoothedOrbitRotation, this._smoothedOrbitRotation); + conjugate(this._orbitDirection, this._smoothedOrbitRotation); + transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); + subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); + transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); + add$4(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); + multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); + fromQuat$1(this._mat3, this._combinedRotation); + this._right[0] = this._mat3[0]; + this._right[1] = this._mat3[1]; + this._right[2] = this._mat3[2]; + this._up[0] = this._mat3[3]; + this._up[1] = this._mat3[4]; + this._up[2] = this._mat3[5]; + this._forward[0] = this._mat3[6]; + this._forward[1] = this._mat3[7]; + this._forward[2] = this._mat3[8]; + const view = this._vMatrices[0]; + view[0] = this._right[0]; + view[1] = this._up[0]; + view[2] = this._forward[0]; + view[4] = this._right[1]; + view[5] = this._up[1]; + view[6] = this._forward[1]; + view[8] = this._right[2]; + view[9] = this._up[2]; + view[10] = this._forward[2]; + view[12] = -dot$1(this._right, this._combinedPosition); + view[13] = -dot$1(this._up, this._combinedPosition); + view[14] = -dot$1(this._forward, this._combinedPosition); + const aspectRatio = this.width / this.height; + if (this._core.config.stereoMode == StereoMode.none) { + if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { + const top = Math.tan(this._core.config.fov * .5) * this._core.config.nearPlane; + const bottom = -top; + const left = -aspectRatio * top; + const width = aspectRatio * top - left; + const height = top - bottom; + const tileWidth = width / this._core.config.tilesX; + const tileHeight = height / this._core.config.tilesY; + frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); + } else perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + invert$1(this._inverseVMatrices[0], this.vMatrices[0]); + invert$1(this._inversePMatrices[0], this.pMatrices[0]); + } else { + cross$1(this._leftToRightEye, this._forward, this._up); + normalize$5(this._leftToRightEye, this._leftToRightEye); + scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); + scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); + this._vMatrices[0][12] += this._core.config.ipd * .5; + copy$7(this._vMatrices[1], this._vMatrices[0]); + this._vMatrices[1][12] -= this._core.config.ipd; + const frustumShift = this._core.config.ipd * .5 * this._core.config.nearPlane / this._core.config.screenDistance; + const top = Math.tan(this._core.config.fov * .5) * this._core.config.nearPlane; + const bottom = -top; + let left = -aspectRatio * top + frustumShift; + let right = aspectRatio * top + frustumShift; + frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + left = -aspectRatio * top - frustumShift; + right = aspectRatio * top - frustumShift; + frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); + invert$1(this._inverseVMatrices[0], this._vMatrices[0]); + invert$1(this._inversePMatrices[0], this._pMatrices[0]); + copy$7(this._inverseVMatrices[1], this._inverseVMatrices[0]); + this._inverseVMatrices[1][12] += this._core.config.ipd; + invert$1(this._inversePMatrices[1], this._pMatrices[1]); + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } + } + _zoom(direction, distance) { + scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance); + } + rotate(translationDelta) {} + zoom(zoomDelta, x, y) { + this.unproject(this._vec3, x, y, 1); + normalize$5(this._vec3, this._vec3); + const distance$2 = zoomDelta * distance(this._combinedPosition, this.modelPosition); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + this._zoom(this._vec3, distance$2); + } + _twist(axis, angle) {} + twist(angle, x, y) {} + updatePickVMatrix(x, y) { + this.unproject(this._vec3, x, y, 1); + lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); + } + syncSmooth() { + copy$6(this._smoothedCameraPosition, this._cameraPosition); + copy$4(this._smoothedCameraRotation, this._cameraRotation); + copy$4(this._smoothedOrbitRotation, this._orbitRotation); + } + updateModelManipulationOrigin(from, to) { + const a = create$6(); + const b = create$6(); + const c = create$6(); + const d = create$6(); + transformMat4$2(a, from, this.modelMMatrix); + transformMat4$2(b, to, this.modelMMatrix); + subtract(a, this._cameraPosition, a); + subtract(b, this._cameraPosition, b); + transformQuat(c, a, this._orbitDirection); + transformQuat(d, b, this._orbitDirection); + subtract(c, c, a); + subtract(d, d, b); + subtract(this._vec3, c, d); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + add$4(this._cameraPosition, this._cameraPosition, this._vec3); + add$4(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); + } + unproject(position, x, y, z) { + set$8(position, 2 * x / this.width - 1, 1 - 2 * y / this.height, z); + transformMat4$2(position, position, this._inversePMatrices[0]); + transformMat4$2(position, position, this._inverseVMatrices[0]); + } + translate(translationDelta) { + const distance$1 = distance(this.modelPosition, this._combinedPosition); + const height = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; + set$8(this._vec3, height * translationDelta[0], -height * translationDelta[1], 0); + transformQuat(this._vec3, this._vec3, this._combinedRotation); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + subtract(this._cameraPosition, this._cameraPosition, this._vec3); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/cameras/altazimuth.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AltAzimuthCamera = class extends CameraBase { + getView(view) { + super.getView(view); + view.altitude = this.altitude; + view.azimuth = this.azimuth; + view.fov = this._core.config.fov; + } + setView(view, isSmooth) { + super.setView(view, isSmooth); + this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); + this._core.config.fov = view.fov; + } + lerpView(from, to, time) { + super.lerpView(from, to, time); + this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time), MathHelper.lerp(from.azimuth, to.azimuth, time), false); + this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time); + } + update(elapsedTime) { + super.update(elapsedTime); + if (this._core.config.isDebugVisible) { + const altitude = AngleHelper.radiansToDegrees(this.altitude); + const azimuth = AngleHelper.radiansToDegrees(this.azimuth); + this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); + this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + } + } + get altitude() { + transformQuat(this._up, Constants$2.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants$2.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants$2.VECTOR3_UNITY, this._up, this._right); + } + get azimuth() { + transformQuat(this._up, Constants$2.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants$2.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants$2.VECTOR3_UNITX, this._right, this._up); + } + setAltAzimuth(altitude, azimuth, isSmooth) { + setAxisAngle(this._quat, Constants$2.VECTOR3_UNITX, altitude); + multiply(this._orbitRotation, this._quat, Constants$2.QUAT_IDENTITY); + setAxisAngle(this._quat, Constants$2.VECTOR3_UNITY, azimuth); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + if (!isSmooth) this.syncSmooth(); + } + rotate(translationDelta) { + const length = Math.min(this.width, this.height); + let angle = translationDelta[1] * Constants$2.PI / length; + setAxisAngle(this._quat, Constants$2.VECTOR3_UNITX, angle); + multiply(this._orbitRotation, this._quat, this._orbitRotation); + angle = translationDelta[0] * Constants$2.PI / length; + setAxisAngle(this._quat, Constants$2.VECTOR3_UNITY, angle); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/config.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Config$2 = class { + constructor(core) { + this.reset(); + } + reset() { + this.isDebugVisible = false; + this.logLevel = LogLevel.warn; + this.shaderPath = "shaders"; + this.fontPath = "fonts"; + this.modelDistance = .5; + this.modelSize = .25; + this.stereoMode = StereoMode.none; + this.ipd = .06; + this.screenDistance = .5; + this.fov = AngleHelper.degreesToRadians(30); + this.nearPlane = .01; + this.farPlane = 100; + this.pickWidth = 512; + this.pickHeight = 512; + this.pickHoldDelay = 1e3; + this.pickSelectDelay = 100; + this.resizeMinimumDelay = 250; + this.rotationSmoothing = .02; + this.positionSmoothing = .02; + this.focusSmoothing = .01; + this.scaleSmoothing = .02; + this.mouseWheelZoomScale = -.002; + this.mouseWheelRotationScale = -.002; + this.dragToleranceSquared = 100; + this.manipulatorMinRelativeDistanceSquared = 100; + this.isMultiTouchEnabled = true; + this.isMultiTouchZoomEnabled = true; + this.isMultiTouchTwistEnabled = true; + this.isMultiTouchRotateEnabled = true; + this.isMultiTouchTranslateEnabled = true; + this.multiTouchZoomScale = 1; + this.cameraMinDistance = .1; + this.cameraMaxDistance = 10; + this.xrControllerRayColor = fromValues$3(.5, .5, .5); + this.xrControllerProfile = "windows-mixed-reality"; + this.xrControllerHandedness = "right"; + this.paletteColor = new Uint8Array([ + 128, + 128, + 128, + 0 + ]); + this.textColor = create$6(); + this.textHoverColor = create$6(); + this.textBorderColor = create$6(); + this.textBorderWidth = 24 / 255; + this.identityRotation = Constants$2.VECTOR3_UNITY; + this.axesTextLabelMaxGlyphs = 32; + this.axesTextColor = create$6(); + this.axesTextBorderColor = create$6(); + this.axesTextHoverColor = create$6(); + this.axesTextLabelMajorSize = .03; + this.axesTextLabelMinorSize = .02; + this.axesTextTitleMaxGlyphs = 127; + this.axesTextTitleSize = .05; + this.axesTextHeadingMaxGlyphs = 128; + this.axesTextHeadingSize = .075; + this.axesTextTitleLineHeight = 1.5; + this.axesTextHeadingLineHeight = 1.5; + this.axesTextLabelLineHeight = 1.5; + this.axesGridMajorThickness = 2e-4; + this.axesGridMinorThickness = 1e-4; + this.axesGridZeroThickness = .002; + this.axesGridPickDivisionHeight = .025; + this.axesGridBackgroundColor = create$6(); + this.axesGridHighlightColor = create$6(); + this.axesGridMinorColor = create$6(); + this.axesGridMajorColor = create$6(); + this.axesGridZeroColor = create$6(); + this.axesGridDefaultDivisions = 10; + this.keyTitleMaxGlyphs = 64; + this.keyLabelMaxGlyphs = 64; + this.selectionColor = create$6(); + this.hoverColor = create$6(); + this.activeColor = create$6(); + this.highlightMode = HighlightMode.color; + this.lassoThickness = 4; + this.lassoDashWidth = 2; + this.lassoColor = create$6(); + this.minCubifiedTreeMapSlice = .01; + this.sdfBuffer = 192; + this.sdfBorder = 0; + this.forceDirectIsEnabled = false; + this.forceDirectAttraction = 1; + this.forceDirectRepulsion = 1; + this.forceDirectGravity = 1; + this.forceDirectInterval = .1; + this.forceDirectMaxDistance = .1; + this.forceDirectTheta = 1; + this.forceDirectIterationsPerLayout = 1; + this.forceDirectEdgeWeightPower = 1; + this.forceDirectLockX = false; + this.forceDirectLockY = false; + this.forceDirectLockZ = false; + this.transitionDuration = 400; + this.transitionStaggering = 100; + this.transitionView = true; + this.isTransitionPickingEnabled = false; + this.backgroundColor = create$5(); + this.theme = Theme.light; + this.ambientColor = create$6(); + this.renderMode = RenderMode.color; + this.tilesX = 1; + this.tilesY = 1; + this.tileOffsetX = 0; + this.tileOffsetY = 0; + } + get theme() { + return this._theme; + } + set theme(value) { + if (this._theme != value) { + this._theme = value; + switch (value) { + case Theme.dark: + set$7(this.backgroundColor, 0, 0, 0, 1); + set$8(this.textColor, .9, .9, .9); + set$8(this.textHoverColor, 1, 1, 1); + set$8(this.textBorderColor, 0, 0, 0); + set$8(this.axesTextColor, .9, .9, .9); + set$8(this.axesTextBorderColor, 0, 0, 0); + set$8(this.axesTextHoverColor, 1, 1, 1); + set$8(this.axesGridBackgroundColor, .02, .02, .02); + set$8(this.axesGridHighlightColor, .04, .04, .04); + set$8(this.axesGridMinorColor, .05, .05, .05); + set$8(this.axesGridMajorColor, .1, .1, .1); + set$8(this.axesGridZeroColor, .05, .1, .1); + set$8(this.selectionColor, 1, 1, 0); + set$8(this.hoverColor, 1, 0, 1); + set$8(this.activeColor, 0, 1, 1); + set$8(this.lassoColor, .9, .9, .9); + break; + case Theme.light: + set$7(this.backgroundColor, 1, 1, 1, 1); + set$8(this.textColor, 0, 0, 0); + set$8(this.textHoverColor, .1, .1, .1); + set$8(this.textBorderColor, 1, 1, 1); + set$8(this.axesTextColor, 0, 0, 0); + set$8(this.axesTextBorderColor, 1, 1, 1); + set$8(this.axesTextHoverColor, .1, .1, .1); + set$8(this.axesGridBackgroundColor, 1, 1, 1); + set$8(this.axesGridHighlightColor, .925, .925, .925); + set$8(this.axesGridMinorColor, .9, .9, .9); + set$8(this.axesGridMajorColor, .8, .8, .8); + set$8(this.axesGridZeroColor, .7, .9, .9); + set$8(this.selectionColor, 1, 1, 0); + set$8(this.hoverColor, 1, 0, 1); + set$8(this.activeColor, 0, 1, 1); + set$8(this.lassoColor, .1, .1, .1); + break; + } + if (this.themeChangedCallback) this.themeChangedCallback(this._theme); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/debug.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var DebugText = class { + get text() { + return this._text; + } + constructor() { + this.clear(); + } + clear() { + this._text = ""; + } + addLine(value) { + this._text += value + "\n"; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/fps.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Fps = class { + get frameCounter() { + return this._frameCounter; + } + get totalFrames() { + return this._totalFrames; + } + constructor(core) { + this._core = core; + this._totalFrames = 0; + this.reset(); + } + update(elapsedTime) { + this._elapsedTime += elapsedTime; + if (this._elapsedTime > 1e3) { + this._elapsedTime -= 1e3; + this._fps = this._frameCounter; + this._frameCounter = 0; + } + if (this._core.config.isDebugVisible) this._core.debugText.addLine(`fps ${this._fps}`); + } + render() { + this._frameCounter++; + this._totalFrames++; + } + reset() { + this._fps = 0; + this._frameCounter = 0; + this._elapsedTime = 0; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/palette.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var PaletteType = { + sequentialsinglehue: "sequentialsinglehue", + sequentialmultihue: "sequentialmultihue", + diverging: "diverging", + qualitative: "qualitative" + }; + var PaletteResources = class { + constructor() { + this.palettes = { + "blues": { + type: PaletteType.sequentialsinglehue, + colors: new Uint8Array([ + 247, + 251, + 255, + 222, + 235, + 247, + 198, + 219, + 239, + 158, + 202, + 225, + 107, + 174, + 214, + 66, + 146, + 198, + 33, + 113, + 181, + 8, + 81, + 156, + 8, + 48, + 107 + ]) + }, + "greens": { + type: PaletteType.sequentialsinglehue, + colors: new Uint8Array([ + 247, + 252, + 245, + 229, + 245, + 224, + 199, + 233, + 192, + 161, + 217, + 155, + 116, + 196, + 118, + 65, + 171, + 93, + 35, + 139, + 69, + 0, + 109, + 44, + 0, + 68, + 27 + ]) + }, + "greys": { + type: PaletteType.sequentialsinglehue, + colors: new Uint8Array([ + 255, + 255, + 255, + 240, + 240, + 240, + 217, + 217, + 217, + 189, + 189, + 189, + 150, + 150, + 150, + 115, + 115, + 115, + 82, + 82, + 82, + 37, + 37, + 37, + 0, + 0, + 0 + ]) + }, + "oranges": { + type: PaletteType.sequentialsinglehue, + colors: new Uint8Array([ + 255, + 245, + 235, + 254, + 230, + 206, + 253, + 208, + 162, + 253, + 174, + 107, + 253, + 141, + 60, + 241, + 105, + 19, + 217, + 72, + 1, + 166, + 54, + 3, + 127, + 39, + 4 + ]) + }, + "purples": { + type: PaletteType.sequentialsinglehue, + colors: new Uint8Array([ + 252, + 251, + 253, + 239, + 237, + 245, + 218, + 218, + 235, + 188, + 189, + 220, + 158, + 154, + 200, + 128, + 125, + 186, + 106, + 81, + 163, + 84, + 39, + 143, + 63, + 0, + 125 + ]) + }, + "reds": { + type: PaletteType.sequentialsinglehue, + colors: new Uint8Array([ + 255, + 245, + 240, + 254, + 224, + 210, + 252, + 187, + 161, + 252, + 146, + 114, + 251, + 106, + 74, + 239, + 59, + 44, + 203, + 24, + 29, + 165, + 15, + 21, + 103, + 0, + 13 + ]) + }, + "viridis": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 72, + 37, + 117, + 65, + 68, + 135, + 53, + 96, + 141, + 42, + 120, + 142, + 33, + 145, + 141, + 34, + 168, + 132, + 67, + 191, + 113, + 122, + 209, + 81, + 188, + 223, + 39 + ]) + }, + "inferno": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 23, + 12, + 59, + 66, + 10, + 104, + 107, + 23, + 110, + 147, + 38, + 103, + 187, + 55, + 85, + 221, + 81, + 58, + 243, + 119, + 26, + 252, + 165, + 10, + 246, + 214, + 69 + ]) + }, + "magma": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 21, + 14, + 55, + 59, + 15, + 112, + 101, + 26, + 128, + 140, + 41, + 129, + 182, + 55, + 122, + 222, + 73, + 104, + 247, + 111, + 92, + 254, + 159, + 109, + 254, + 206, + 145 + ]) + }, + "plasma": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 66, + 3, + 157, + 106, + 0, + 168, + 144, + 13, + 164, + 177, + 42, + 144, + 203, + 71, + 121, + 225, + 100, + 98, + 242, + 131, + 76, + 252, + 166, + 54, + 252, + 206, + 37 + ]) + }, + "bluegreen": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 247, + 252, + 253, + 229, + 245, + 249, + 204, + 236, + 230, + 153, + 216, + 201, + 102, + 194, + 164, + 65, + 174, + 118, + 35, + 139, + 69, + 0, + 109, + 44, + 0, + 68, + 27 + ]) + }, + "bluepurple": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 247, + 252, + 253, + 224, + 236, + 244, + 191, + 211, + 230, + 158, + 188, + 218, + 140, + 150, + 198, + 140, + 107, + 177, + 136, + 65, + 157, + 129, + 15, + 124, + 77, + 0, + 75 + ]) + }, + "greenblue": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 247, + 252, + 240, + 224, + 243, + 219, + 204, + 235, + 197, + 168, + 221, + 181, + 123, + 204, + 196, + 78, + 179, + 211, + 43, + 140, + 190, + 8, + 104, + 172, + 8, + 64, + 129 + ]) + }, + "orangered": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 247, + 236, + 254, + 232, + 200, + 253, + 212, + 158, + 253, + 187, + 132, + 252, + 141, + 89, + 239, + 101, + 72, + 215, + 48, + 31, + 179, + 0, + 0, + 127, + 0, + 0 + ]) + }, + "purpleblue": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 247, + 251, + 236, + 231, + 242, + 208, + 209, + 230, + 166, + 189, + 219, + 116, + 169, + 207, + 54, + 144, + 192, + 5, + 112, + 176, + 4, + 90, + 141, + 2, + 56, + 88 + ]) + }, + "purplebluegreen": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 247, + 251, + 236, + 226, + 240, + 208, + 209, + 230, + 166, + 189, + 219, + 103, + 169, + 207, + 54, + 144, + 192, + 2, + 129, + 138, + 1, + 108, + 89, + 1, + 70, + 54 + ]) + }, + "purplered": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 247, + 244, + 249, + 231, + 225, + 239, + 212, + 185, + 218, + 201, + 148, + 199, + 223, + 101, + 176, + 231, + 41, + 138, + 206, + 18, + 86, + 152, + 0, + 67, + 103, + 0, + 31 + ]) + }, + "redpurple": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 247, + 243, + 253, + 224, + 221, + 252, + 197, + 192, + 250, + 159, + 181, + 247, + 104, + 161, + 221, + 52, + 151, + 174, + 1, + 126, + 122, + 1, + 119, + 73, + 0, + 106 + ]) + }, + "yellowgreen": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 255, + 229, + 247, + 252, + 185, + 217, + 240, + 163, + 173, + 221, + 142, + 120, + 198, + 121, + 65, + 171, + 93, + 35, + 132, + 67, + 0, + 104, + 55, + 0, + 69, + 41 + ]) + }, + "yellowgreenblue": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 255, + 217, + 237, + 248, + 177, + 199, + 233, + 180, + 127, + 205, + 187, + 65, + 182, + 196, + 29, + 145, + 192, + 34, + 94, + 168, + 37, + 52, + 148, + 8, + 29, + 88 + ]) + }, + "yelloworangebrown": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 255, + 229, + 255, + 247, + 188, + 254, + 227, + 145, + 254, + 196, + 79, + 254, + 153, + 41, + 236, + 112, + 20, + 204, + 76, + 2, + 153, + 52, + 4, + 102, + 37, + 6 + ]) + }, + "yelloworangered": { + type: PaletteType.sequentialmultihue, + colors: new Uint8Array([ + 255, + 255, + 204, + 255, + 237, + 160, + 254, + 217, + 118, + 254, + 178, + 76, + 253, + 141, + 60, + 252, + 78, + 42, + 227, + 26, + 28, + 189, + 0, + 38, + 128, + 0, + 38 + ]) + }, + "brownbluegreen": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 84, + 48, + 5, + 140, + 81, + 10, + 191, + 129, + 45, + 223, + 194, + 125, + 246, + 232, + 195, + 245, + 245, + 245, + 199, + 234, + 229, + 128, + 205, + 193, + 53, + 151, + 143, + 1, + 102, + 94, + 0, + 60, + 48 + ]) + }, + "pinkyellowgreen": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 142, + 1, + 82, + 197, + 27, + 125, + 222, + 119, + 174, + 241, + 182, + 218, + 253, + 224, + 239, + 247, + 247, + 247, + 230, + 245, + 208, + 184, + 225, + 134, + 127, + 188, + 65, + 77, + 146, + 33, + 39, + 100, + 25 + ]) + }, + "purplegreen": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 64, + 0, + 75, + 118, + 42, + 131, + 153, + 112, + 171, + 194, + 165, + 207, + 231, + 212, + 232, + 247, + 247, + 247, + 217, + 240, + 211, + 166, + 219, + 160, + 90, + 174, + 97, + 27, + 120, + 55, + 0, + 68, + 27 + ]) + }, + "purpleorange": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 127, + 59, + 8, + 179, + 88, + 6, + 224, + 130, + 20, + 253, + 184, + 99, + 254, + 224, + 182, + 247, + 247, + 247, + 216, + 218, + 235, + 178, + 171, + 210, + 128, + 115, + 172, + 84, + 39, + 136, + 45, + 0, + 75 + ]) + }, + "redblue": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 103, + 0, + 31, + 178, + 24, + 43, + 214, + 96, + 77, + 244, + 165, + 130, + 253, + 219, + 199, + 247, + 247, + 247, + 209, + 229, + 240, + 146, + 197, + 222, + 67, + 147, + 195, + 33, + 102, + 172, + 5, + 48, + 97 + ]) + }, + "redgrey": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 103, + 0, + 31, + 178, + 24, + 43, + 214, + 96, + 77, + 244, + 165, + 130, + 253, + 219, + 199, + 255, + 255, + 255, + 224, + 224, + 224, + 186, + 186, + 186, + 135, + 135, + 135, + 77, + 77, + 77, + 26, + 26, + 26 + ]) + }, + "redyellowblue": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 165, + 0, + 38, + 215, + 48, + 39, + 244, + 109, + 67, + 253, + 174, + 97, + 254, + 224, + 144, + 255, + 255, + 191, + 224, + 243, + 248, + 171, + 217, + 233, + 116, + 173, + 209, + 69, + 117, + 180, + 49, + 54, + 149 + ]) + }, + "redyellowgreen": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 165, + 0, + 38, + 215, + 48, + 39, + 244, + 109, + 67, + 253, + 174, + 97, + 254, + 224, + 139, + 255, + 255, + 191, + 217, + 239, + 139, + 166, + 217, + 106, + 102, + 189, + 99, + 26, + 152, + 80, + 0, + 104, + 55 + ]) + }, + "spectral": { + type: PaletteType.diverging, + colors: new Uint8Array([ + 158, + 1, + 66, + 213, + 62, + 79, + 244, + 109, + 67, + 253, + 174, + 97, + 254, + 224, + 139, + 255, + 255, + 191, + 230, + 245, + 152, + 171, + 221, + 164, + 102, + 194, + 165, + 50, + 136, + 189, + 94, + 79, + 162 + ]) + }, + "accent": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 127, + 201, + 127, + 190, + 174, + 212, + 253, + 192, + 134, + 255, + 255, + 153, + 56, + 108, + 176, + 240, + 2, + 127, + 191, + 91, + 23, + 102, + 102, + 102 + ]) + }, + "category10": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 31, + 119, + 180, + 255, + 127, + 14, + 44, + 160, + 44, + 214, + 39, + 40, + 148, + 103, + 189, + 140, + 86, + 75, + 227, + 119, + 194, + 127, + 127, + 127, + 188, + 189, + 34, + 23, + 190, + 207 + ]) + }, + "category20": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 31, + 119, + 180, + 174, + 199, + 232, + 255, + 127, + 14, + 255, + 187, + 120, + 44, + 160, + 44, + 152, + 223, + 138, + 214, + 39, + 40, + 255, + 152, + 150, + 148, + 103, + 189, + 197, + 176, + 213, + 140, + 86, + 75, + 196, + 156, + 148, + 227, + 119, + 194, + 247, + 182, + 210, + 127, + 127, + 127, + 199, + 199, + 199, + 188, + 189, + 34, + 219, + 219, + 141, + 23, + 190, + 207, + 158, + 218, + 229 + ]) + }, + "dark2": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 27, + 158, + 119, + 217, + 95, + 2, + 117, + 112, + 179, + 231, + 41, + 138, + 102, + 166, + 30, + 230, + 171, + 2, + 166, + 118, + 29, + 102, + 102, + 102 + ]) + }, + "paired": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 166, + 206, + 227, + 31, + 120, + 180, + 178, + 223, + 138, + 51, + 160, + 44, + 251, + 154, + 153, + 227, + 26, + 28, + 253, + 191, + 111, + 255, + 127, + 0, + 202, + 178, + 214, + 106, + 61, + 154, + 255, + 255, + 153, + 177, + 89, + 40 + ]) + }, + "pastel1": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 251, + 180, + 174, + 179, + 205, + 227, + 204, + 235, + 197, + 222, + 203, + 228, + 254, + 217, + 166, + 255, + 255, + 204, + 229, + 216, + 189, + 253, + 218, + 236, + 242, + 242, + 242 + ]) + }, + "pastel2": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 179, + 226, + 205, + 253, + 205, + 172, + 203, + 213, + 232, + 244, + 202, + 228, + 230, + 245, + 201, + 255, + 242, + 174, + 241, + 226, + 204, + 204, + 204, + 204 + ]) + }, + "set1": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 228, + 26, + 28, + 55, + 126, + 184, + 77, + 175, + 74, + 152, + 78, + 163, + 255, + 127, + 0, + 255, + 255, + 51, + 166, + 86, + 40, + 247, + 129, + 191, + 153, + 153, + 153 + ]) + }, + "set2": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 102, + 194, + 165, + 252, + 141, + 98, + 141, + 160, + 203, + 231, + 138, + 195, + 166, + 216, + 84, + 255, + 217, + 47, + 229, + 196, + 148, + 179, + 179, + 179 + ]) + }, + "set3": { + type: PaletteType.qualitative, + colors: new Uint8Array([ + 141, + 211, + 199, + 255, + 255, + 179, + 190, + 186, + 218, + 251, + 128, + 114, + 128, + 177, + 211, + 253, + 180, + 98, + 179, + 222, + 105, + 252, + 205, + 229, + 217, + 217, + 217, + 188, + 128, + 189, + 204, + 235, + 197, + 255, + 237, + 111 + ]) + } + }; + } + }; + var PaletteBase = class { + get colors() { + return this._colors; + } + set colors(value) { + if (this._colors != value) { + this._colors = value; + this._changed = true; + } + } + constructor() { + this._colors = null; + } + copyFrom(palette) { + if (palette.colors) this.colors = new Uint8Array(palette.colors); + else this.colors = null; + } + update() {} + }; + var Palette$3 = class extends PaletteBase {}; + //#endregion + //#region ../../node_modules/morphcharts/dist/vertex.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var PositionVertex = class PositionVertex { + static getPosition(buffer, index, value) { + const offset = index * PositionVertex.SIZE; + set$8(value, buffer[offset], buffer[offset + 1], buffer[offset + 2]); + } + static setPosition(buffer, index, value) { + const offset = index * PositionVertex.SIZE; + buffer[offset] = value[0]; + buffer[offset + 1] = value[1]; + buffer[offset + 2] = value[2]; + } + }; + PositionVertex.SIZE = 3; + PositionVertex.SIZE_BYTES = 12; + var PositionColorVertex = class PositionColorVertex { + static getPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getColor(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + set$8(value, bufferView.getUint8(offset) / 255, bufferView.getUint8(offset + 1) / 255, bufferView.getUint8(offset + 2) / 255); + } + static setColor(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 255); + bufferView.setUint8(offset + 1, value[1] * 255); + bufferView.setUint8(offset + 2, value[2] * 255); + } + }; + PositionColorVertex.SIZE_BYTES = 16; + PositionColorVertex.POSITION_OFFSET_BYTES = 0; + PositionColorVertex.COLOR_OFFSET_BYTES = 12; + var PositionTextureVertex = class { + static getPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getTexCoord(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set$5(value, bufferView.getUint16(offset, true) / 65535, bufferView.getUint16(offset + 2, true) / 65535); + } + static setTexCoord(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 65535, true); + bufferView.setUint16(offset + 2, value[1] * 65535, true); + } + }; + PositionTextureVertex.SIZE_BYTES = 16; + PositionTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; + var PositionTexturePickVertex = class PositionTexturePickVertex { + static getPosition(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getTexCoord(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set$5(value, bufferView.getUint16(offset, true) / 65535, bufferView.getUint16(offset + 2, true) / 65535); + } + static setTexCoord(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 65535, true); + bufferView.setUint16(offset + 2, value[1] * 65535, true); + } + static getIdColor(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + set$7(value, bufferView.getUint8(offset) / 255, bufferView.getUint8(offset + 1) / 255, bufferView.getUint8(offset + 2) / 255, bufferView.getUint8(offset + 3) / 255); + } + static setIdColor(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 255); + bufferView.setUint8(offset + 1, value[1] * 255); + bufferView.setUint8(offset + 2, value[2] * 255); + bufferView.setUint8(offset + 3, value[3] * 255); + } + }; + PositionTexturePickVertex.SIZE_BYTES = 20; + PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; + PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; + PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; + var PositionNormalVertex = class PositionNormalVertex { + static getPosition(bufferView, index, value) { + const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getNormal(bufferView, index, value) { + const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + set$8(value, bufferView.getInt8(offset) / 127, bufferView.getInt8(offset + 1) / 127, bufferView.getInt8(offset + 2) / 127); + } + static setNormal(bufferView, index, value) { + const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset, value[0] * 127); + bufferView.setInt8(offset + 1, value[1] * 127); + bufferView.setInt8(offset + 2, value[2] * 127); + } + }; + PositionNormalVertex.SIZE_BYTES = 16; + PositionNormalVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalVertex.NORMAL_OFFSET_BYTES = 12; + var PositionNormalColorVertex = class PositionNormalColorVertex { + static getPosition(bufferView, index, value) { + const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getNormal(bufferView, index, value) { + const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + set$8(value, bufferView.getInt8(offset) / 127, bufferView.getInt8(offset + 1) / 127, bufferView.getInt8(offset + 2) / 127); + } + static setNormal(bufferView, index, value) { + const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset, value[0] * 127); + bufferView.setInt8(offset + 1, value[1] * 127); + bufferView.setInt8(offset + 2, value[2] * 127); + } + static getColor(bufferView, index, value) { + const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + set$8(value, bufferView.getUint8(offset) / 255, bufferView.getUint8(offset + 1) / 255, bufferView.getUint8(offset + 2) / 255); + } + static setColor(bufferView, index, value) { + const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 255); + bufferView.setUint8(offset + 1, value[1] * 255); + bufferView.setUint8(offset + 2, value[2] * 255); + } + }; + PositionNormalColorVertex.SIZE_BYTES = 20; + PositionNormalColorVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalColorVertex.NORMAL_OFFSET_BYTES = 12; + PositionNormalColorVertex.COLOR_OFFSET_BYTES = 16; + var PositionNormalTextureVertex = class PositionNormalTextureVertex { + static getPosition(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getNormal(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + set$8(value, bufferView.getInt8(offset) / 127, bufferView.getInt8(offset + 1) / 127, bufferView.getInt8(offset + 2) / 127); + } + static setNormal(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset, value[0] * 127); + bufferView.setInt8(offset + 1, value[1] * 127); + bufferView.setInt8(offset + 2, value[2] * 127); + } + static getTexCoord(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set$5(value, bufferView.getUint16(offset, true) / 65535, bufferView.getUint16(offset + 2, true) / 65535); + } + static setTexCoord(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 65535, true); + bufferView.setUint16(offset + 2, value[1] * 65535, true); + } + }; + PositionNormalTextureVertex.SIZE_BYTES = 20; + PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; + PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; + var PickGridVertex = class PickGridVertex { + static getTranslation(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setTranslation(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getNormal(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + set$8(value, bufferView.getInt8(offset) / 127, bufferView.getInt8(offset + 1) / 127, bufferView.getInt8(offset + 2) / 127); + } + static setNormal(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset, value[0] * 127); + bufferView.setInt8(offset + 1, value[1] * 127); + bufferView.setInt8(offset + 2, value[2] * 127); + } + static getIdColor(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + set$7(value, bufferView.getUint8(offset) / 255, bufferView.getUint8(offset + 1) / 255, bufferView.getUint8(offset + 2) / 255, bufferView.getUint8(offset + 3) / 255); + } + static setIdColor(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 255); + bufferView.setUint8(offset + 1, value[1] * 255); + bufferView.setUint8(offset + 2, value[2] * 255); + bufferView.setUint8(offset + 3, value[3] * 255); + } + static getTexCoord(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set$5(value, bufferView.getUint16(offset, true) / 65535, bufferView.getUint16(offset + 2, true) / 65535); + } + static setTexCoord(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 65535, true); + bufferView.setUint16(offset + 2, value[1] * 65535, true); + } + static getBounds(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; + set$7(value, bufferView.getUint16(offset, true) / 65535, bufferView.getUint16(offset + 2, true) / 65535, bufferView.getUint16(offset + 4, true) / 65535, bufferView.getUint16(offset + 6, true) / 65535); + } + static setBounds(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 65535, true); + bufferView.setUint16(offset + 2, value[1] * 65535, true); + bufferView.setUint16(offset + 4, value[2] * 65535, true); + bufferView.setUint16(offset + 6, value[3] * 65535, true); + } + }; + PickGridVertex.SIZE_BYTES = 32; + PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; + PickGridVertex.NORMAL_OFFSET_BYTES = 12; + PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; + PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; + PickGridVertex.BOUNDS_OFFSET_BYTES = 24; + var UnitVertex = class UnitVertex { + static getIdHover(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, true); + } + static setIdHover(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, value, true); + } + static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); + } + static getTranslation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setTranslation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + set$5(value, bufferView.getUint8(offset) / 255, bufferView.getUint8(offset + 1) / 255); + } + static setColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 255); + bufferView.setUint8(offset + 1, value[1] * 255); + } + static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + } + static getOrder(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; + set$5(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true)); + } + static setOrder(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + } + static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + } + static getScale(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; + set$8(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setScale(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getRotation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; + set$6(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); + } + static setRotation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + bufferView.setFloat32(offset + 12, value[3], true); + } + static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getTexCoord(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; + set$6(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); + } + static setTexCoord(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + bufferView.setFloat32(offset + 12, value[3], true); + } + static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getIdColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + set$7(value, bufferView.getUint8(offset) / 255, bufferView.getUint8(offset + 1) / 255, bufferView.getUint8(offset + 2) / 255, bufferView.getUint8(offset + 3) / 255); + } + static setIdColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 255); + bufferView.setUint8(offset + 1, value[1] * 255); + bufferView.setUint8(offset + 2, value[2] * 255); + bufferView.setUint8(offset + 3, value[3] * 255); + } + static getSelected(bufferView, index) { + return bufferView.getInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES) / 127; + } + static setSelected(bufferView, index, value) { + bufferView.setInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES, value * 127); + } + static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); + } + static getRounding(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, true); + } + static setRounding(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, value, true); + } + static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); + } + static getParameter1(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, true); + } + static setParameter1(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, value, true); + } + static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); + } + static getParameter2(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, true); + } + static setParameter2(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, value, true); + } + static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); + } + static getMaterial(bufferView, index) { + return bufferView.getUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES); + } + static setMaterial(bufferView, index, value) { + bufferView.setUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES, value); + } + static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); + } + static getTexture(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES); + } + static setTexture(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES, value); + } + static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); + } + static getSdfBuffer(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES); + } + static setSdfBuffer(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES, value); + } + static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); + } + static getSdfBorder(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES); + } + static setSdfBorder(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES, value); + } + static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); + } + static getMatId(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES, value); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint16(offset) / 255; + value[1] = bufferView.getUint16(offset + 2) / 255; + value[2] = bufferView.getUint16(offset + 4) / 255; + } + static setMatColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 255); + bufferView.setUint16(offset + 2, value[1] * 255); + bufferView.setUint16(offset + 4, value[2] * 255); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset) / 255; + } + static setMatFuzz(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset, value * 255); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset) / 255; + } + static setMatGloss(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset, value * 255); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, value, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint8(offset) / 255; + value[1] = bufferView.getUint8(offset + 1) / 255; + value[2] = bufferView.getUint8(offset + 2) / 255; + value[3] = bufferView.getUint8(offset + 3) / 255; + } + static setSegColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 255); + bufferView.setUint8(offset + 1, value[1] * 255); + bufferView.setUint8(offset + 2, value[2] * 255); + bufferView.setUint8(offset + 3, value[3] * 255); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); + } + }; + UnitVertex.SIZE_BYTES = 120; + UnitVertex.ID_HOVER_OFFSET_BYTES = 0; + UnitVertex.ID_COLOR_OFFSET_BYTES = 4; + UnitVertex.ORDER_OFFSET_BYTES = 8; + UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; + UnitVertex.SELECTED_OFFSET_BYTES = 80; + UnitVertex.TRANSLATION_OFFSET_BYTES = 16; + UnitVertex.COLOR_OFFSET_BYTES = 28; + UnitVertex.MATERIAL_OFFSET_BYTES = 30; + UnitVertex.SCALE_OFFSET_BYTES = 32; + UnitVertex.ROUNDING_OFFSET_BYTES = 44; + UnitVertex.ROTATION_OFFSET_BYTES = 48; + UnitVertex.TEXCOORD_OFFSET_BYTES = 64; + UnitVertex.TEXTURE_OFFSET_BYTES = 81; + UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; + UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; + UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; + UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; + UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; + UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; + UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; + UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; + UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; + UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; + UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/obj.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ObjMesh = class {}; + var ObjHelper = class { + constructor(core) { + this._core = core; + } + read(data) { + const start = window.performance.now(); + const indices = []; + const positions = []; + const normals = []; + const texCoords = []; + const meshes = []; + const indexOffsets = []; + const indexCounts = []; + const faceLookup = {}; + const lines = data.split("\n"); + let faceCount = 0; + for (let i = 0; i < lines.length; i++) { + const parts = lines[i].trim().split(" "); + if (parts.length > 0) switch (parts[0]) { + case "o": + meshes.push(parts[1]); + indexOffsets.push(indices.length); + break; + case "v": + positions.push(parseFloat(parts[1])); + positions.push(parseFloat(parts[2])); + positions.push(parseFloat(parts[3])); + break; + case "vt": + texCoords.push(parseFloat(parts[1])); + texCoords.push(parseFloat(parts[2])); + break; + case "vn": + normals.push(parseFloat(parts[1])); + normals.push(parseFloat(parts[2])); + normals.push(parseFloat(parts[3])); + break; + case "f": + for (let i = 0; i < parts.length - 1; i++) { + const part = parts[i + 1]; + if (faceLookup[part] == void 0) faceLookup[part] = faceCount++; + indices.push(faceLookup[part]); + } + break; + default: break; + } + } + for (let i = 0; i < meshes.length - 1; i++) indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); + indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); + const dataView = new DataView(vertices); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let minZ = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY = -Number.MAX_VALUE; + let maxZ = -Number.MAX_VALUE; + const faces = Object.keys(faceLookup); + const _vec2 = create$3(); + const _vec3 = create$6(); + let hasTexCoords, hasNormals; + if (faces.length > 0) { + const faceParts = faces[0].split("/"); + hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); + hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); + } + for (let i = 0; i < faces.length; i++) { + const faceParts = faces[i].split("/"); + let index = (parseInt(faceParts[0]) - 1) * 3; + const x = positions[index]; + const y = positions[index + 1]; + const z = positions[index + 2]; + set$8(_vec3, x, y, z); + PositionNormalTextureVertex.setPosition(dataView, i, _vec3); + minX = Math.min(x, minX); + minY = Math.min(y, minY); + minZ = Math.min(z, minZ); + maxX = Math.max(x, maxX); + maxY = Math.max(y, maxY); + maxZ = Math.max(z, maxZ); + if (hasNormals) { + index = (parseInt(faceParts[2]) - 1) * 3; + set$8(_vec3, normals[index], normals[index + 1], normals[index + 2]); + PositionNormalTextureVertex.setNormal(dataView, i, _vec3); + } + if (hasTexCoords) { + index = (parseInt(faceParts[1]) - 1) * 2; + set$5(_vec2, texCoords[index], texCoords[index + 1]); + PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); + } + } + const originX = (minX + maxX) / 2; + const originY = (minY + maxY) / 2; + const originZ = (minZ + maxZ) / 2; + const objMesh = new ObjMesh(); + objMesh.vertices = vertices; + objMesh.indices = new Uint16Array(indices); + objMesh.meshes = meshes; + objMesh.indexOffsets = indexOffsets; + objMesh.indexCounts = indexCounts; + objMesh.indexCount = indices.length; + objMesh.minX = minX; + objMesh.minY = minY; + objMesh.minZ = minZ; + objMesh.maxX = maxX; + objMesh.maxY = maxY; + objMesh.maxZ = maxZ; + objMesh.originX = originX; + objMesh.originY = originY; + objMesh.originZ = originZ; + this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); + return objMesh; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/meshes/cube.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cube = class {}; + Cube.POSITIONS = new Float32Array([ + -.5, + .5, + .5, + .5, + .5, + .5, + .5, + -.5, + .5, + -.5, + -.5, + .5, + -.5, + .5, + -.5, + .5, + .5, + -.5, + .5, + -.5, + -.5, + -.5, + -.5, + -.5 + ]); + Cube.INDICES = new Uint16Array([ + 5, + 4, + 1, + 0, + 3, + 4, + 7, + 5, + 6, + 1, + 2, + 3, + 6, + 7 + ]); + Cube.CUBE_MAP_INDICES = new Uint16Array([ + 2, + 3, + 1, + 0, + 4, + 3, + 7, + 2, + 6, + 1, + 5, + 4, + 6, + 7 + ]); + Cube.FACE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Cube.FACE_POSITIONS = [ + fromValues$3(0, .5, 0), + fromValues$3(.5, 0, 0), + fromValues$3(0, -.5, 0), + fromValues$3(-.5, 0, 0), + fromValues$3(0, 0, .5), + fromValues$3(0, 0, -.5) + ]; + Cube.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), + fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), + fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), + fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Cube.EDGE_POSITIONS = [ + fromValues$3(0, .5, .5), + fromValues$3(.5, .5, 0), + fromValues$3(0, .5, -.5), + fromValues$3(-.5, .5, 0), + fromValues$3(0, -.5, .5), + fromValues$3(.5, -.5, 0), + fromValues$3(0, -.5, -.5), + fromValues$3(-.5, -.5, 0), + fromValues$3(.5, 0, .5), + fromValues$3(.5, 0, -.5), + fromValues$3(-.5, 0, -.5), + fromValues$3(-.5, 0, .5) + ]; + Cube.EDGE_NORMALS = [ + fromValues$3(0, Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, 0, Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, 0, -Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, 0, -Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, 0, Constants$2.ROOT_TWO_OVER_TWO) + ]; + Cube.EDGE_CORNERS = [ + [0, 1], + [1, 5], + [4, 5], + [0, 4], + [2, 3], + [2, 6], + [6, 7], + [3, 7], + [1, 2], + [5, 6], + [4, 7], + [0, 3] + ]; + Cube.EDGE_FACES = [ + [0, 4], + [0, 1], + [0, 5], + [0, 3], + [2, 4], + [2, 1], + [2, 5], + [2, 3], + [1, 4], + [1, 5], + [3, 5], + [3, 4] + ]; + Cube.EDGE_AXIS = [ + 0, + 2, + 0, + 2, + 0, + 2, + 0, + 2, + 1, + 1, + 1, + 1 + ]; + Cube.AXIS_EDGES = [ + [ + 0, + 2, + 4, + 6 + ], + [ + 8, + 9, + 10, + 11 + ], + [ + 1, + 3, + 5, + 7 + ] + ]; + Cube.AXIS_FACES = [ + [1, 3], + [0, 2], + [4, 5] + ]; + Cube.OPPOSITE_FACES = [ + 2, + 3, + 0, + 1, + 5, + 4 + ]; + Cube.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0) + ]; + Cube.EDGE_FORWARDS = [ + fromValues$3(0, Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, -Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, Constants$2.ROOT_TWO_OVER_TWO, 0), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, 0, Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, 0, Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$2.ROOT_TWO_OVER_TWO, 0, -Constants$2.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$2.ROOT_TWO_OVER_TWO, 0, -Constants$2.ROOT_TWO_OVER_TWO) + ]; + //#endregion + //#region ../../node_modules/morphcharts/dist/components/controller.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ControllerVisual$1 = class { + render(elapsedTime, xrFrame) {} + update(elapsedTime) {} + constructor(controller) { + this.controller = controller; + } + }; + var Controller = class { + get isInitialized() { + return this._isInitialized; + } + get mMatrix() { + return this._mMatrix; + } + get indexCount() { + return this._indexCount; + } + get vertices() { + return this._vertices; + } + get indices() { + return this._indices; + } + get texture() { + return this._texture; + } + get rayMMatrix() { + return this._rayMMatrix; + } + get rayIndexCount() { + return this._rayIndexCount; + } + get rayVertices() { + return this._rayVertices; + } + get rayIndices() { + return this._rayIndices; + } + constructor(core, options) { + this._cubeObj = `o Cube v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 @@ -8212,21842 +10207,23409 @@ f 1/12/3 5/6/3 2/8/3 f 2/12/4 6/8/4 3/4/4 f 4/13/5 3/9/5 8/11/5 f 5/6/6 1/12/6 8/11/6`; - this._core = core; - this._obj = options2.obj; - this._texture = options2.texture || new ImageData(new Uint8ClampedArray([0, 0, 0, 255]), 1, 1); - } - initialize() { - const _vec3 = create$6(); - this._mMatrix = create$7(); - const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); - if (!this._obj) { - this.useRayPose = true; - const modelThickness = 0.02; - const modelLength = 0.1; - set$8(_vec3, modelThickness, modelThickness, modelLength); - fromScaling(this._mMatrix, _vec3); - set$8(_vec3, 0, 0, 1); - translate$2(this._mMatrix, this._mMatrix, _vec3); - } - this._vertices = objMesh.vertices; - this._indices = objMesh.indices; - this._indexCount = objMesh.indexCount; - this._rayMMatrix = create$7(); - const rayVertices = Cube.POSITIONS; - this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); - const rayVerticesView = new DataView(this._rayVertices); - const rayIndices = Cube.INDICES; - this._rayIndices = new Uint16Array(rayIndices); - const rayVertexCount = rayVertices.length / PositionVertex.SIZE; - this._rayIndexCount = rayIndices.length; - for (let i = 0; i < rayVertexCount; i++) { - set$8(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); - PositionColorVertex.setPosition(rayVerticesView, i, _vec3); - PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); - } - const rayThickness = 25e-4; - const rayLength = 10; - set$8(_vec3, rayThickness, rayThickness, rayLength); - fromScaling(this._rayMMatrix, _vec3); - set$8(_vec3, 0, 0, -0.5); - translate$2(this._rayMMatrix, this._rayMMatrix, _vec3); - this._isInitialized = true; - this._core.log.write(LogLevel.info, "controller initialized"); - } - update(elapsedTime) { - } - } - class MatrixHelper { - static fieldOfViewFromProjectionMatrix(p) { - return 2 * Math.atan(1 / p[5]); - } - } - class AxesVisual { - render(elapsedTime, xrFrame) { - } - update(elapsedTime) { - } - constructor(axes) { - this.axes = axes; - } - } - class AxesBase { - get isInitialized() { - return this._isInitialized; - } - set vMatrix(value2) { - this._vMatrix = value2; - } - pickGrid(id2) { - const offset2 = id2 * 3; - return { - divisionX: this._pickGrid[offset2] - 1, - divisionY: this._pickGrid[offset2 + 1] - 1, - divisionZ: this._pickGrid[offset2 + 2] - 1 - }; - } - pickTitle(id2) { - return { axis: this._pickTitle[id2] }; - } - pickLabel(id2) { - const offset2 = id2 * 2; - return { - axis: this._pickLabel[offset2], - label: this._pickLabel[offset2 + 1] - }; - } - pickHeading(id2) { - return { axis: this._pickHeading[id2] }; - } - getFromValues(index2) { - return this._fromValues[index2]; - } - setFromValues(index2, value2) { - if (this._fromValues[index2] != value2) { - this._fromValues[index2] = value2; - this._hasChanged = true; - } - } - getToValues(index2) { - return this._toValues[index2]; - } - setToValues(index2, value2) { - if (this._toValues[index2] != value2) { - this._toValues[index2] = value2; - this._hasChanged = true; - } - } - get font() { - return this._font; - } - set font(value2) { - if (this._font != value2) { - this._font = value2; - this._hasChanged = true; - } - } - get gridPickDivisionHeight() { - return this._gridPickDivisionHeight; - } - set gridPickDivisionHeight(value2) { - if (this._gridPickDivisionHeight != value2) { - this._gridPickDivisionHeight = value2; - this._hasChanged = true; - } - } - constructor(core) { - this._core = core; - this._mMatrix = create$7(); - this._mvMatrix = create$7(); - this._textMetric = { maxTop: 0, width: 0, maxHeight: 0 }; - this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; - this.textBorderWidth = core.config.textBorderWidth; - this.gamma = 0; - this.gridMajorThickness = core.config.axesGridMajorThickness; - this.gridMinorThickness = core.config.axesGridMinorThickness; - this.gridZeroThickness = core.config.axesGridZeroThickness; - this._font = core.font; - this.isGridPickingEnabled = false; - } - update(elapsedTime) { - } - } - let Quad$3 = class Quad { - static positions(transform2) { - const positions2 = new Float32Array(12); - const position2 = create$6(); - for (let i = 0; i < 4; i++) { - set$8(position2, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); - transformMat4$2(position2, position2, transform2); - positions2[i * 3] = position2[0]; - positions2[i * 3 + 1] = position2[1]; - positions2[i * 3 + 2] = position2[2]; - } - return positions2; - } - static textured(transform2, texTransform = Constants$1.MAT4_IDENTITY) { - const positions2 = this.positions(transform2); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions2.length / 3); - const verticesView = new DataView(vertices); - const position2 = create$6(); - const texCoord = create$3(); - for (let i = 0; i < positions2.length / PositionVertex.SIZE; i++) { - set$8(position2, positions2[i * PositionVertex.SIZE], positions2[i * PositionVertex.SIZE + 1], positions2[i * PositionVertex.SIZE + 2]); - set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - transformMat4(texCoord, texCoord, texTransform); - PositionTextureVertex.setPosition(verticesView, i, position2); - PositionTextureVertex.setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - static normalTextured(transform2, texTransform = Constants$1.MAT4_IDENTITY) { - const positions2 = this.positions(transform2); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions2.length / 3); - const verticesView = new DataView(vertices); - const position2 = create$6(); - const texCoord = create$3(); - const normal3 = create$6(); - const normal4 = create$5(); - for (let i = 0; i < positions2.length / PositionVertex.SIZE; i++) { - set$8(position2, positions2[i * PositionVertex.SIZE], positions2[i * PositionVertex.SIZE + 1], positions2[i * PositionVertex.SIZE + 2]); - set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - transformMat4(texCoord, texCoord, texTransform); - PositionNormalTextureVertex.setPosition(verticesView, i, position2); - set$7(normal4, 0, 0, 1, 0); - transformMat4$1(normal4, normal4, transform2); - set$8(normal3, normal4[0], normal4[1], normal4[2]); - normalize$5(normal3, normal3); - PositionNormalTextureVertex.setNormal(verticesView, i, normal3); - PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - }; - Quad$3.FACE_NORMALS = [ - fromValues$3(0, 0, 1), - fromValues$3(0, 0, -1) - ]; - Quad$3.FACE_ROTATIONS = [ - fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), - fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) - ]; - Quad$3.EDGE_POSITIONS = [ - fromValues$3(0, 0.5, 0), - fromValues$3(0.5, 0, 0), - fromValues$3(0, -0.5, 0), - fromValues$3(-0.5, 0, 0) - ]; - Quad$3.EDGE_NORMALS = [ - fromValues$3(0, 1, 0), - fromValues$3(1, 0, 0), - fromValues$3(0, -1, 0), - fromValues$3(-1, 0, 0) - ]; - Quad$3.EDGE_POSITIVES = [ - fromValues$3(1, 0, 0), - fromValues$3(0, 1, 0), - fromValues$3(1, 0, 0), - fromValues$3(0, 1, 0) - ]; - Quad$3.EDGE_FORWARDS = [ - fromValues$3(0, 0, -1), - fromValues$3(0, 0, 1), - fromValues$3(0, 0, 1), - fromValues$3(0, 0, -1) - ]; - Quad$3.AXIS_EDGES = [ - [0, 2], - [1, 3] - ]; - Quad$3.POSITIONS = new Float32Array([ - -0.5, - 0.5, - 0, - 0.5, - 0.5, - 0, - -0.5, - -0.5, - 0, - 0.5, - -0.5, - 0 - ]); - Quad$3.INDICES = new Uint16Array([0, 2, 1, 1, 2, 3]); - Quad$3.TEX_COORDS = new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]); - class TextHelper { - static truncate(text2, length2) { - return text2.length > length2 ? `${text2.substr(0, length2 - 1)}…` : text2; - } - static measure(font2, text2, size) { - size.width = 0; - let maxDescent = 0; - for (const char of text2) { - let glyph = font2.glyphs[char]; - if (!glyph) { - font2.addGlyph(char); - glyph = font2.glyphs[char]; - } - size.width += glyph.advance; - size.maxTop = Math.max(glyph.top, size.maxTop); - maxDescent = Math.max(glyph.height - glyph.top, maxDescent); - } - size.maxHeight = size.maxTop + maxDescent; - } - static wrap(font2, text2, maxWidth) { - const lines = []; - let width2 = 0; - let start = 0; - let lastBreakingChar = -1; - let widthAfterLastBreakingChar = 0; - for (let i = 0; i < text2.length; i++) { - let char = text2.charAt(i); - let glyph = font2.glyphs[char]; - if (!glyph) { - font2.addGlyph(char); - glyph = font2.glyphs[char]; - } - width2 += glyph.advance; - if (char == " " || char == "-") { - widthAfterLastBreakingChar = width2; - lastBreakingChar = i; - } - if (width2 > maxWidth) { - if (lastBreakingChar == -1) { - lines.push(text2.substring(start, i)); - start = i; - width2 += glyph.advance; - } else { - lines.push(text2.substring(start, lastBreakingChar)); - start = lastBreakingChar + 1; - width2 -= widthAfterLastBreakingChar; - widthAfterLastBreakingChar = 0; - lastBreakingChar = -1; - } - } - } - lines.push(text2.substring(start, text2.length)); - return lines; - } - static addString(font2, text2, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { - for (const char of text2) { - this.addGlyph(font2, char, vertices, indices, index2++, position2, scale2, offset2, rotation2, idColor); - } - } - static addGlyph(font2, char, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { - let glyph = font2.glyphs[char]; - if (!glyph) { - font2.addGlyph(char); - glyph = font2.glyphs[char]; - } - const vertexOffset = index2 * 4; - const width2 = glyph.width * scale2; - const height2 = glyph.height * scale2; - const top = glyph.top * scale2; - const border = font2.border * scale2; - const x02 = offset2[0] - border; - const x12 = offset2[0] + width2 + border; - const y02 = offset2[1] + top + border; - const y12 = offset2[1] + top - height2 - border; - const z02 = offset2[2]; - set$8(this._topLeft, x02, y02, z02); - set$8(this._topRight, x12, y02, z02); - set$8(this._bottomLeft, x02, y12, z02); - set$8(this._bottomRight, x12, y12, z02); - if (rotation2) { - transformQuat(this._topLeft, this._topLeft, rotation2); - transformQuat(this._topRight, this._topRight, rotation2); - transformQuat(this._bottomLeft, this._bottomLeft, rotation2); - transformQuat(this._bottomRight, this._bottomRight, rotation2); - } - add$4(this._vec3, this._topLeft, position2); - PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); - add$4(this._vec3, this._topRight, position2); - PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); - add$4(this._vec3, this._bottomLeft, position2); - PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); - add$4(this._vec3, this._bottomRight, position2); - PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); - set$5(this._vec2, glyph.u0, glyph.v0); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); - set$5(this._vec2, glyph.u1, glyph.v0); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); - set$5(this._vec2, glyph.u0, glyph.v1); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); - set$5(this._vec2, glyph.u1, glyph.v1); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); - offset2[0] += glyph.advance * scale2; - const indexTemplate = Quad$3.INDICES; - const indexOffset = index2 * 6; - for (let i = 0; i < 6; i++) { - indices[indexOffset + i] = indexTemplate[i] + vertexOffset; - } - } - } - TextHelper._vec2 = create$3(); - TextHelper._vec3 = create$6(); - TextHelper._topLeft = create$6(); - TextHelper._topRight = create$6(); - TextHelper._bottomLeft = create$6(); - TextHelper._bottomRight = create$6(); - class PickHelper { - static nextPickId() { - return this._pickId++; - } - static encodeNumber(number2, type2, color2) { - const encoded = number2 | PickHelper.encodeType(type2); - PickHelper.float32ToVec4(encoded, color2); - } - static decodeNumber(color2) { - return color2[0] + (color2[1] << 8) + (color2[2] << 16); - } - static encodeVec3(vec3, type2, color2) { - const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type2); - PickHelper.float32ToVec4(encoded, color2); - } - static decodeVec3(color2, axes) { - axes[0] = color2[0]; - axes[1] = color2[1]; - axes[2] = color2[2]; - } - static encodeType(type2) { - return type2 << 24; - } - static decodeType(color2) { - return color2[3]; - } - static float32ToVec4(number2, color2) { - color2[0] = ((number2 & 255) >>> 0) / 255; - color2[1] = ((number2 & 65280) >>> 8) / 255; - color2[2] = ((number2 & 16711680) >>> 16) / 255; - color2[3] = ((number2 & 4278190080) >>> 24) / 255; - } - static uint8ArrayToNumber(color2) { - return color2[0] + (color2[1] << 8) + (color2[2] << 16) + (color2[3] << 24); - } - } - PickHelper._pickId = 1; - class Cartesian3dAxes extends AxesBase { - get size() { - return this._size; - } - get isDiscreteX() { - return this._isDiscrete[0]; - } - set isDiscreteX(value2) { - if (value2 != this._isDiscrete[0]) { - this._isDiscrete[0] = value2; - this._hasChanged = true; - } - } - get isDiscreteY() { - return this._isDiscrete[1]; - } - set isDiscreteY(value2) { - if (value2 != this._isDiscrete[1]) { - this._isDiscrete[1] = value2; - this._hasChanged = true; - } - } - get isDiscreteZ() { - return this._isDiscrete[2]; - } - set isDiscreteZ(value2) { - if (value2 != this._isDiscrete[2]) { - this._isDiscrete[2] = value2; - this._hasChanged = true; - } - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value2) { - if (value2 != this._minBoundsX) { - this._minBoundsX = value2; - this._hasChanged = true; - } - } - get maxBoundsX() { - return this._maxBoundsX; - } - set maxBoundsX(value2) { - if (value2 != this._minBoundsX) { - this._maxBoundsX = value2; - this._hasChanged = true; - } - } - get minBoundsY() { - return this._minBoundsY; - } - set minBoundsY(value2) { - if (value2 != this._minBoundsY) { - this._minBoundsY = value2; - this._hasChanged = true; - } - } - get maxBoundsY() { - return this._maxBoundsY; - } - set maxBoundsY(value2) { - if (value2 != this._minBoundsY) { - this._maxBoundsY = value2; - this._hasChanged = true; - } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value2) { - if (value2 != this._minBoundsZ) { - this._minBoundsZ = value2; - this._hasChanged = true; - } - } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value2) { - if (value2 != this._minBoundsZ) { - this._maxBoundsZ = value2; - this._hasChanged = true; - } - } - getIsOutsideEdge(index2) { - return this._isOutsideEdge[index2]; - } - getIsForwardFace(index2) { - return this._isForwardFace[index2]; - } - get textVertices() { - return this._textVertices; - } - get textIndices() { - return this._textIndices; - } - getLabelMMatrix(index2) { - return this._labelMMatrices[index2]; - } - setLabelPositions(index2, value2) { - if (this._labelPositions[index2] != value2) { - this._labelPositions[index2] = value2; - this._hasChanged = true; - } - } - setLabels(index2, value2) { - if (this._labels[index2] != value2) { - this._labels[index2] = value2; - this._hasChanged = true; - } - } - setLabelSizes(index2, value2) { - if (this._labelSizes[index2] != value2) { - this._labelSizes[index2] = value2; - this._hasChanged = true; - } - } - getLabelOrientation(index2) { - return this._orientations[index2]; - } - setLabelOrientation(index2, orientation) { - if (this._orientations[index2] != orientation) { - this._orientations[index2] = orientation; - this._hasChanged = true; - } - } - getTitleIndexCount(index2) { - return this._titleIndexCounts[index2]; - } - getTitleIndexOffset(index2) { - return this._titleIndexOffsets[index2]; - } - getTitleMMatrix(index2) { - return this._titleMMatrices[index2]; - } - setTitle(index2, value2) { - if (this._titles[index2] != value2) { - this._titles[index2] = value2; - this._hasChanged = true; - } - } - setTitleSize(index2, value2) { - if (this._titleSizes[index2] != value2) { - this._titleSizes[index2] = value2; - this._hasChanged = true; - } - } - getHeadingIndexCount(index2) { - return this._headingIndexCounts[index2]; - } - getHeadingIndexOffset(index2) { - return this._headingIndexOffsets[index2]; - } - getHeadingMMatrix(index2) { - return this._headingMMatrices[index2]; - } - setHeading(index2, value2) { - if (this._headings[index2] != value2) { - this._headings[index2] = value2; - this._hasChanged = true; - } - } - setHeadingSize(index2, value2) { - if (this._headingSizes[index2] != value2) { - this._headingSizes[index2] = value2; - this._hasChanged = true; - } - } - getIsLeftToRightHorizontal(index2) { - return this._isLeftToRightHorizontal[index2]; - } - getIsLeftToRightVertical(index2) { - return this._isLeftToRightVertical[index2]; - } - getAxesLeftToRightIndexCount(index2) { - return this._axesLeftToRightIndexCounts[index2]; - } - getAxesRightToLeftIndexCount(index2) { - return this._axesRightToLeftIndexCounts[index2]; - } - getAxesLeftToRightIndexOffset(index2) { - return this._axesLeftToRightIndexOffsets[index2]; - } - getAxesRightToLeftIndexOffset(index2) { - return this._axesRightToLeftIndexOffsets[index2]; - } - get gridVertices() { - return this._gridVertices; - } - get gridIndices() { - return this._gridIndices; - } - getGridTicksIndexCount(index2) { - return this._gridTicksIndexCounts[index2]; - } - getGridTicksIndexOffset(index2) { - return this._gridTicksIndexOffsets[index2]; - } - getGridFaceIndexCount(index2) { - return this._gridFaceIndexCounts[index2]; - } - getGridFaceIndexOffset(index2) { - return this._gridFaceIndexOffsets[index2]; - } - getGridTicksMMatrix(index2) { - return this._gridTicksMMatrices[index2]; - } - getGridFaceMMatrix(index2) { - return this._gridFaceMMatrices[index2]; - } - getGridTicksScale(index2) { - return this._gridTicksScales[index2]; - } - getGridFaceZero(index2) { - return this._gridFaceZeros[index2]; - } - getGridTicksZero(index2) { - return this._gridTicksZeros[index2]; - } - getGridFaceMinorGridlines(index2) { - return this._gridFaceMinorGridlines[index2]; - } - getGridTicksMinorGridlines(index2) { - return this._gridTicksMinorGridlines[index2]; - } - setTickPositions(index2, value2) { - if (this._gridTicksPositions[index2] != value2) { - this._gridTicksPositions[index2] = value2; - this._hasChanged = true; - } - } - get scalingX() { - return this._scalingX; - } - set scalingX(value2) { - if (value2 != this._scalingX) { - this._scalingX = value2; - this._hasChanged = true; - } - } - get scalingY() { - return this._scalingY; - } - set scalingY(value2) { - if (value2 != this._scalingY) { - this._scalingY = value2; - this._hasChanged = true; - } - } - get scalingZ() { - return this._scalingZ; - } - set scalingZ(value2) { - if (value2 != this._scalingZ) { - this._scalingZ = value2; - this._hasChanged = true; - } - } - get offsetX() { - return this._offset[12]; - } - set offsetX(value2) { - if (value2 != this._offset[12]) { - this._offset[12] = value2; - } - } - get offsetY() { - return this._offset[13]; - } - set offsetY(value2) { - if (value2 != this._offset[13]) { - this._offset[13] = value2; - } - } - get offsetZ() { - return this._offset[14]; - } - set offsetZ(value2) { - if (value2 != this._offset[14]) { - this._offset[14] = value2; - } - } - constructor(core) { - super(core); - this._size = create$6(); - this._translation = create$6(); - this._normal = create$6(); - this._forward = create$6(); - this._right = create$6(); - this._up = create$6(); - this._texCoord = create$3(); - this._bounds = create$5(); - this._vec3 = create$6(); - this._vec4 = create$5(); - this._mat3 = create$8(); - this._isDiscrete = [false, false, false]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._minBoundsZ = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._maxBoundsZ = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for (let i = 0; i < 6; i++) { - this._isForwardFace.push(false); - } - for (let i = 0; i < 12; i++) { - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = create$6(); - this._textPosition = create$6(); - this._distances = []; - for (let i = 0; i < 12; i++) { - this._distances.push(0); - } - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for (let i = 0; i < 3; i++) { - this._maxLabelSize.push(create$3()); - this._orientations.push(AxesTextOrientation.parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for (let i = 0; i < 12; i++) { - this._labelMMatrices.push(create$7()); - } - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for (let i = 0; i < 3; i++) { - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for (let i = 0; i < 12; i++) { - this._titleMMatrices.push(create$7()); - } - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for (let i = 0; i < 3; i++) { - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for (let i = 0; i < 12; i++) { - this._headingMMatrices.push(create$7()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = create$6(); - this._edgePositive = create$6(); - this._edgeNormal = create$6(); - this._edgeNormalTemp = create$6(); - this._edgePositiveTemp = create$6(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for (let i = 0; i < 12; i++) { - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push(create$6()); - this._edgeHorizontalUp.push(create$6()); - this._edgeHorizontalForward.push(create$6()); - this._edgeVerticalRight.push(create$6()); - this._edgeVerticalUp.push(create$6()); - this._edgeVerticalForward.push(create$6()); - } - this.isFaceVisible = []; - for (let i = 0; i < 6; i++) { - this.isFaceVisible.push(true); - } - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = Quad$3.INDICES; - this.zero = create$6(); - this._gridTicksZeros = []; - this._gridFaceZeros = []; - this.minorGridlines = fromValues$3(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = []; - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = create$6(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for (let i = 0; i < 3; i++) { - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push(create$3()); - this._gridFaceZeros.push(create$3()); - this._gridTicksMinorGridlines.push(create$3()); - this._gridFaceMinorGridlines.push(create$3()); - this._gridTicksScales.push(create$6()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - } - for (let i = 0; i < 6; i++) { - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push(create$7()); - } - for (let i = 0; i < 12; i++) { - this._gridTicksMMatrices.push(create$7()); - this._gridTicksRotations.push(create$7()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = Cube.EDGE_POSITIVES[i][0]; - _mat4[1] = Cube.EDGE_POSITIVES[i][1]; - _mat4[2] = Cube.EDGE_POSITIVES[i][2]; - _mat4[4] = Cube.EDGE_NORMALS[i][0]; - _mat4[5] = Cube.EDGE_NORMALS[i][1]; - _mat4[6] = Cube.EDGE_NORMALS[i][2]; - cross$1(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [null, null, null]; - this._toValues = [null, null, null]; - this.isDivisionPickingEnabled = [false, false, false]; - this.isLabelPickingEnabled = [false, false, false]; - this.isTitlePickingEnabled = [false, false, false]; - this.isHeadingPickingEnabled = [false, false, false]; - this.isAxisReversed = [false, false, false]; - this._scalingX = 1; - this._scalingY = 1; - this._scalingZ = 1; - this._offset = create$7(); - } - initialize() { - this._isInitialized = true; - } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._size[2] *= this._scalingZ / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); - } - multiply$2(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = create$7(); - multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); - fromMat4(this._mat3, this._mvMatrix); - for (let faceId = 0; faceId < 6; faceId++) { - multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); - transformMat4$2(this._forward, this._vec3, this._mvMatrix); - transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for (let edgeId = 0; edgeId < 12; edgeId++) { - const faceIds = Cube.EDGE_FACES[edgeId]; - const forward1 = this._isForwardFace[faceIds[0]]; - const forward2 = this._isForwardFace[faceIds[1]]; - const outsideEdge = forward1 != forward2; - this._isOutsideEdge[edgeId] = outsideEdge; - if (outsideEdge) { - this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; - } - this._distances[edgeId] = 0; - } - for (let axisId = 0; axisId < 3; axisId++) { - if (this.arePickDivisionsVisible[axisId]) { - set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); - set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { - let distance2 = this._distances[edgeId]; - distance2 += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); - translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); - multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) { - scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$1.VECTOR3_REFLECTX); - } - scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance2 += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance2; - } - } - } - } - for (let axisId = 0; axisId < 3; axisId++) { - if (this.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - set$5(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); - set$5(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - if (this._size[axisId] > 0) { - translate$2(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); - } - } - } - } - } - for (let axisId = 0; axisId < 3; axisId++) { - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId]) { - multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); - transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); - normalize$5(this._forward, this._edgePosition); - negate(this._forward, this._forward); - cross$1(this._right, Constants$1.VECTOR3_UNITY, this._forward); - normalize$5(this._right, this._right); - cross$1(this._up, this._forward, this._right); - transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); - transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); - copy$6(this._edgeNormalTemp, this._edgeNormal); - copy$6(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if (dot$1(this._edgeNormalTemp, this._up) > 0) { - copy$6(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); - } else { - negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); - negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if (dot$1(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - copy$6(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); - negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if (dot$1(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - negate(edgeHorizontalRight, edgeHorizontalRight); - } - cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if (dot$1(this._edgeNormal, this._right) < 0) { - copy$6(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); - } else { - negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); - negate(this._edgeNormal, this._edgeNormal); - } - if (dot$1(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - copy$6(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); - negate(this._edgePositive, this._edgePositive); - } - cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if (dot$1(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - negate(edgeVerticalRight, edgeVerticalRight); - } - cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) { - this._updateLabels(axisId, edgeId); - } - if (this._titles[axisId]) { - this._updateTitle(axisId, edgeId); - } - } - if (this.isHeadingVisible[edgeId]) { - this._updateHeading(axisId, edgeId); - } - } - } - } - } - } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance2 = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == AxesTextOrientation.parallel) - maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance2 += maxLabelSize * 0.5; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == AxesTextOrientation.parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == AxesTextOrientation.perpendicular) { - multiply$2(labelMMatrix, labelMMatrix, Constants$1.MAT4_ROTATION_MINUS_90); - } - distance2 += maxLabelSize * 0.5; - this._distances[edgeId] = distance2; - } - _updateTitle(axisId, edgeId) { - let distance2 = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance2 += titleTextSize * 0.5; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); - distance2 += titleTextSize * 0.5; - this._distances[edgeId] = distance2; - } - _updateHeading(axisId, edgeId) { - let distance2 = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance2 += headingTextSize * 0.5; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); - distance2 += headingTextSize * 0.5; - this._distances[edgeId] = distance2; - } - _updateGrids(size) { - let offset2 = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; - const count2 = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; - const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count2 * 6); - } - for (let axisId = 0; axisId < 3; axisId++) { - const width2 = size[axisId]; - set$8(this._gridTicksScales[axisId], width2, this._gridPickDivisionHeight, 1); - offset2 = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset2); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); - } - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - } - _updateText(size) { - let glyphOffset = 0; - let count2 = 0; - for (let axisId = 0; axisId < 3; axisId++) { - const labels = this._labels[axisId]; - if (labels) { - for (let i = 0; i < labels.length; i++) { - count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - } - } - const title = this._titles[axisId]; - if (title) { - count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - } - const heading = this._headings[axisId]; - if (heading) { - count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - } - const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count2 * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for (let axisId = 0; axisId < 3; axisId++) { - if (this._labels[axisId]) { - const width2 = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - set$5(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for (let axisId = 0; axisId < 3; axisId++) { - if (this._titles[axisId]) { - set$8(this._textPosition, 0, 0, 0); - set$8(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale2 = this._titleSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const lineHeight2 = this._font.size * scale2; - this._textOffset[0] -= width2 / 2; - this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for (let axisId = 0; axisId < 3; axisId++) { - if (this._headings[axisId]) { - set$8(this._textPosition, 0, 0, 0); - set$8(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale2 = this._headingSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const lineHeight2 = this._font.size * scale2; - this._textOffset[0] -= width2 / 2; - this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } - } - } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label2 = 0; label2 < labels.length; label2++) { - const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight2 = scales2[label2]; - const scale2 = lineHeight2 / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$8(this._textPosition, (position2 - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width2 / 2; - } else { - this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; - maxSize[0] = Math.max(width2, maxSize[0]); - maxSize[1] = Math.max(lineHeight2, maxSize[1]); - break; - case AxesTextOrientation.perpendicular: - set$8(this._textPosition, 0, (position2 - 0.5) * size, 0); - this._textOffset[0] = -width2 / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } else { - this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - } - maxSize[0] = Math.max(lineHeight2, maxSize[0]); - maxSize[1] = Math.max(width2, maxSize[1]); - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label2); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - } - return glyphOffset; - } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label2 = 0; label2 < labels.length; label2++) { - const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight2 = scales2[label2]; - const scale2 = lineHeight2 / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$8(this._textPosition, (0.5 - position2) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width2 / 2; - } else { - this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; - break; - case AxesTextOrientation.perpendicular: - set$8(this._textPosition, 0, (0.5 - position2) * size, 0); - this._textOffset[0] = -width2 / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } else { - this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; - } - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label2); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset2) { - this._gridTicksIndexOffsets[axisId] = offset2 * 6; - if (this._gridTicksPositions[axisId]) { - const axes = create$6(); - const positions2 = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset2 * 4; - for (let position2 = 0; position2 < positions2.length - 1; position2++) { - const left = isAxisReversed ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const right = isAxisReversed ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId] = position2 + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset2 * 6; - for (let j = 0; j < this._indexTemplate.length; j++) { - indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - } - set$7(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset2++; - } - } - this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; - return offset2; - } - _updateGridFace(axisId, faceId, dataView, indices, offset2) { - set$8(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset2 * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = create$6(); - negate(this._normal, Cube.FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for (let position2 = 0; position2 < positions2.length - 1; position2++) { - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset2 * 4; - for (let position3 = 0; position3 < positions3.length - 1; position3++) { - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset2 * 6; - for (let i = 0; i < this._indexTemplate.length; i++) { - indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - } - set$7(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset2++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; - return offset2; - } - } - class Cartesian2dAxes extends AxesBase { - get size() { - return this._size; - } - get isDiscreteX() { - return this._isDiscrete[0]; - } - set isDiscreteX(value2) { - if (value2 != this._isDiscrete[0]) { - this._isDiscrete[0] = value2; - this._hasChanged = true; - } - } - get isDiscreteY() { - return this._isDiscrete[1]; - } - set isDiscreteY(value2) { - if (value2 != this._isDiscrete[1]) { - this._isDiscrete[1] = value2; - this._hasChanged = true; - } - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value2) { - if (value2 != this._minBoundsX) { - this._minBoundsX = value2; - this._hasChanged = true; - } - } - get maxBoundsX() { - return this._maxBoundsX; - } - set maxBoundsX(value2) { - if (value2 != this._minBoundsX) { - this._maxBoundsX = value2; - this._hasChanged = true; - } - } - get minBoundsY() { - return this._minBoundsY; - } - set minBoundsY(value2) { - if (value2 != this._minBoundsY) { - this._minBoundsY = value2; - this._hasChanged = true; - } - } - get maxBoundsY() { - return this._maxBoundsY; - } - set maxBoundsY(value2) { - if (value2 != this._minBoundsY) { - this._maxBoundsY = value2; - this._hasChanged = true; - } - } - getIsOutsideEdge(index2) { - return this._isOutsideEdge[index2]; - } - getIsForwardFace(index2) { - return this._isForwardFace[index2]; - } - get textVertices() { - return this._textVertices; - } - get textIndices() { - return this._textIndices; - } - getLabelMMatrix(index2) { - return this._labelMMatrices[index2]; - } - setLabelPositions(index2, value2) { - if (this._labelPositions[index2] != value2) { - this._labelPositions[index2] = value2; - this._hasChanged = true; - } - } - setLabels(index2, value2) { - if (this._labels[index2] != value2) { - this._labels[index2] = value2; - this._hasChanged = true; - } - } - setLabelSizes(index2, value2) { - if (this._labelSizes[index2] != value2) { - this._labelSizes[index2] = value2; - this._hasChanged = true; - } - } - getLabelOrientation(index2) { - return this._orientations[index2]; - } - setLabelOrientation(index2, orientation) { - if (this._orientations[index2] != orientation) { - this._orientations[index2] = orientation; - this._hasChanged = true; - } - } - getTitleIndexCount(index2) { - return this._titleIndexCounts[index2]; - } - getTitleIndexOffset(index2) { - return this._titleIndexOffsets[index2]; - } - getTitleMMatrix(index2) { - return this._titleMMatrices[index2]; - } - setTitle(index2, value2) { - if (this._titles[index2] != value2) { - this._titles[index2] = value2; - this._hasChanged = true; - } - } - setTitleSize(index2, value2) { - if (this._titleSizes[index2] != value2) { - this._titleSizes[index2] = value2; - this._hasChanged = true; - } - } - getHeadingIndexCount(index2) { - return this._headingIndexCounts[index2]; - } - getHeadingIndexOffset(index2) { - return this._headingIndexOffsets[index2]; - } - getHeadingMMatrix(index2) { - return this._headingMMatrices[index2]; - } - setHeading(index2, value2) { - if (this._headings[index2] != value2) { - this._headings[index2] = value2; - this._hasChanged = true; - } - } - setHeadingSize(index2, value2) { - if (this._headingSizes[index2] != value2) { - this._headingSizes[index2] = value2; - this._hasChanged = true; - } - } - getIsLeftToRightHorizontal(index2) { - return this._isLeftToRightHorizontal[index2]; - } - getIsLeftToRightVertical(index2) { - return this._isLeftToRightVertical[index2]; - } - getAxesLeftToRightIndexCount(index2) { - return this._axesLeftToRightIndexCounts[index2]; - } - getAxesRightToLeftIndexCount(index2) { - return this._axesRightToLeftIndexCounts[index2]; - } - getAxesLeftToRightIndexOffset(index2) { - return this._axesLeftToRightIndexOffsets[index2]; - } - getAxesRightToLeftIndexOffset(index2) { - return this._axesRightToLeftIndexOffsets[index2]; - } - get gridVertices() { - return this._gridVertices; - } - get gridIndices() { - return this._gridIndices; - } - getGridTicksIndexCount(index2) { - return this._gridTicksIndexCounts[index2]; - } - getGridTicksIndexOffset(index2) { - return this._gridTicksIndexOffsets[index2]; - } - getGridFaceIndexCount(index2) { - return this._gridFaceIndexCounts[index2]; - } - getGridFaceIndexOffset(index2) { - return this._gridFaceIndexOffsets[index2]; - } - getGridTicksMMatrix(index2) { - return this._gridTicksMMatrices[index2]; - } - getGridFaceMMatrix(index2) { - return this._gridFaceMMatrices[index2]; - } - getGridTicksScale(index2) { - return this._gridTicksScales[index2]; - } - getGridTicksZero(index2) { - return this._gridTicksZeros[index2]; - } - get gridFaceZero() { - return this._gridFaceZeros; - } - get gridFaceMinorGridlines() { - return this._gridFaceMinorGridlines; - } - getGridTicksMinorGridlines(index2) { - return this._gridTicksMinorGridlines[index2]; - } - setTickPositions(index2, value2) { - if (this._gridTicksPositions[index2] != value2) { - this._gridTicksPositions[index2] = value2; - this._hasChanged = true; - } - } - get scalingX() { - return this._scalingX; - } - set scalingX(value2) { - if (value2 != this._scalingX) { - this._scalingX = value2; - this._hasChanged = true; - } - } - get scalingY() { - return this._scalingY; - } - set scalingY(value2) { - if (value2 != this._scalingY) { - this._scalingY = value2; - this._hasChanged = true; - } - } - get offsetX() { - return this._offset[12]; - } - set offsetX(value2) { - if (value2 != this._offset[12]) { - this._offset[12] = value2; - } - } - get offsetY() { - return this._offset[13]; - } - set offsetY(value2) { - if (value2 != this._offset[13]) { - this._offset[13] = value2; - } - } - set rotation(value2) { - if (this._rotation != value2) { - this._rotation = value2; - this._rMatrix = create$7(); - fromQuat(this._rMatrix, value2); - } - } - constructor(core) { - super(core); - this._size = create$6(); - this._translation = create$6(); - this._normal = create$6(); - this._forward = create$6(); - this._right = create$6(); - this._up = create$6(); - this._texCoord = create$3(); - this._bounds = create$5(); - this._vec3 = create$6(); - this._vec4 = create$5(); - this._mat3 = create$8(); - this._isDiscrete = [false, false]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for (let i = 0; i < 2; i++) { - this._isForwardFace.push(false); - } - for (let i = 0; i < 4; i++) { - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = create$6(); - this._textPosition = create$6(); - this._distances = []; - for (let i = 0; i < 4; i++) { - this._distances.push(0); - } - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for (let i = 0; i < 2; i++) { - this._maxLabelSize.push(create$3()); - this._orientations.push(AxesTextOrientation.parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for (let i = 0; i < 4; i++) { - this._labelMMatrices.push(create$7()); - } - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for (let i = 0; i < 2; i++) { - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for (let i = 0; i < 4; i++) { - this._titleMMatrices.push(create$7()); - } - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for (let i = 0; i < 2; i++) { - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for (let i = 0; i < 4; i++) { - this._headingMMatrices.push(create$7()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = create$6(); - this._edgePositive = create$6(); - this._edgeNormal = create$6(); - this._edgeNormalTemp = create$6(); - this._edgePositiveTemp = create$6(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for (let i = 0; i < 4; i++) { - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push(create$6()); - this._edgeHorizontalUp.push(create$6()); - this._edgeHorizontalForward.push(create$6()); - this._edgeVerticalRight.push(create$6()); - this._edgeVerticalUp.push(create$6()); - this._edgeVerticalForward.push(create$6()); - } - this.isFaceVisible = []; - for (let i = 0; i < 2; i++) { - this.isFaceVisible.push(true); - } - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = Quad$3.INDICES; - this.zero = create$6(); - this._gridTicksZeros = []; - this._gridFaceZeros = create$3(); - this.minorGridlines = fromValues$3(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = create$3(); - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = create$6(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for (let i = 0; i < 2; i++) { - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push(create$3()); - this._gridTicksMinorGridlines.push(create$3()); - this._gridTicksScales.push(create$6()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push(create$7()); - } - for (let i = 0; i < 4; i++) { - this._gridTicksMMatrices.push(create$7()); - this._gridTicksRotations.push(create$7()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = Quad$3.EDGE_POSITIVES[i][0]; - _mat4[1] = Quad$3.EDGE_POSITIVES[i][1]; - _mat4[2] = Quad$3.EDGE_POSITIVES[i][2]; - _mat4[4] = Quad$3.EDGE_NORMALS[i][0]; - _mat4[5] = Quad$3.EDGE_NORMALS[i][1]; - _mat4[6] = Quad$3.EDGE_NORMALS[i][2]; - cross$1(this._vec3, Quad$3.EDGE_POSITIVES[i], Quad$3.EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [null, null]; - this._toValues = [null, null]; - this.isDivisionPickingEnabled = [false, false]; - this.isLabelPickingEnabled = [false, false]; - this.isTitlePickingEnabled = [false, false]; - this.isHeadingPickingEnabled = [false, false]; - this.isAxisReversed = [false, false]; - this._scalingX = 1; - this._scalingY = 1; - this._offset = create$7(); - } - initialize() { - this._isInitialized = true; - } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); - const maxBounds = Math.max(this._size[0], this._size[1]); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); - } - if (this._rMatrix) { - mul(this._mMatrix, this.mMatrix, this._rMatrix); - mul(this._mMatrix, this._mMatrix, this._offset); - } else { - multiply$2(this._mMatrix, this.mMatrix, this._offset); - } - this._mvMatrix = create$7(); - multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); - fromMat4(this._mat3, this._mvMatrix); - for (let faceId = 0; faceId < 2; faceId++) { - transformMat4$2(this._forward, Constants$1.VECTOR3_ZERO, this._mvMatrix); - transformMat3(this._normal, Quad$3.FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for (let edgeId = 0; edgeId < 4; edgeId++) { - this._isForwardEdge[edgeId] = dot$1(Quad$3.EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for (let axisId = 0; axisId < 2; axisId++) { - if (this.arePickDivisionsVisible[axisId]) { - set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); - set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; - if (this.isEdgeVisible[edgeId]) { - let distance2 = this._distances[edgeId]; - distance2 += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); - translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); - multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) { - scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$1.VECTOR3_REFLECTX); - } - scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance2 += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance2; - } - } - } - } - set$5(this._gridFaceZeros, this.zero[0], this.zero[1]); - set$5(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); - for (let faceId = 0; faceId < 2; faceId++) { - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - } - } - for (let axisId = 0; axisId < 2; axisId++) { - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; - multiply$1(this._edgePosition, Quad$3.EDGE_POSITIONS[edgeId], this._size); - transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); - normalize$5(this._forward, this._edgePosition); - negate(this._forward, this._forward); - cross$1(this._right, Constants$1.VECTOR3_UNITY, this._forward); - normalize$5(this._right, this._right); - cross$1(this._up, this._forward, this._right); - transformMat3(this._edgeNormal, Quad$3.EDGE_NORMALS[edgeId], this._mat3); - transformMat3(this._edgePositive, Quad$3.EDGE_POSITIVES[edgeId], this._mat3); - copy$6(this._edgeNormalTemp, this._edgeNormal); - copy$6(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if (dot$1(this._edgeNormalTemp, this._up) > 0) { - copy$6(edgeHorizontalUp, Quad$3.EDGE_NORMALS[edgeId]); - } else { - negate(edgeHorizontalUp, Quad$3.EDGE_NORMALS[edgeId]); - negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if (dot$1(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - copy$6(edgeHorizontalRight, Quad$3.EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - negate(edgeHorizontalRight, Quad$3.EDGE_POSITIVES[edgeId]); - negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if (dot$1(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - negate(edgeHorizontalRight, edgeHorizontalRight); - } - cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if (dot$1(this._edgeNormal, this._right) < 0) { - copy$6(edgeVerticalUp, Quad$3.EDGE_NORMALS[edgeId]); - } else { - negate(edgeVerticalUp, Quad$3.EDGE_NORMALS[edgeId]); - negate(this._edgeNormal, this._edgeNormal); - } - if (dot$1(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - copy$6(edgeVerticalRight, Quad$3.EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - negate(edgeVerticalRight, Quad$3.EDGE_POSITIVES[edgeId]); - negate(this._edgePositive, this._edgePositive); - } - cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if (dot$1(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - negate(edgeVerticalRight, edgeVerticalRight); - } - cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) { - this._updateLabels(axisId, edgeId); - } - if (this._titles[axisId]) { - this._updateTitle(axisId, edgeId); - } - } - if (this.isHeadingVisible[edgeId]) { - this._updateHeading(axisId, edgeId); - } - } - } - } - } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance2 = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == AxesTextOrientation.parallel) - maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance2 += maxLabelSize * 0.5; - multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == AxesTextOrientation.parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == AxesTextOrientation.perpendicular) { - multiply$2(labelMMatrix, labelMMatrix, Constants$1.MAT4_ROTATION_MINUS_90); - } - distance2 += maxLabelSize * 0.5; - this._distances[edgeId] = distance2; - } - _updateTitle(axisId, edgeId) { - let distance2 = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance2 += titleTextSize * 0.5; - multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); - distance2 += titleTextSize * 0.5; - this._distances[edgeId] = distance2; - } - _updateHeading(axisId, edgeId) { - let distance2 = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance2 += headingTextSize * 0.5; - multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); - distance2 += headingTextSize * 0.5; - this._distances[edgeId] = distance2; - } - _updateGrids(size) { - let offset2 = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const count2 = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; - const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count2 * 6); - } - for (let axisId2 = 0; axisId2 < 2; axisId2++) { - const width2 = size[axisId2]; - set$8(this._gridTicksScales[axisId2], width2, this._gridPickDivisionHeight, 1); - offset2 = this._updateGridTicks(axisId2, this._gridVerticesView, this._gridIndices, offset2); - this._gridFaceScale[axisId2] = size[axisId2] == 0 ? 1 : size[axisId2]; - } - const axisId = 2; - this._gridFaceScale[axisId] = 1; - for (let faceId = 0; faceId < 2; faceId++) { - offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); - } - } - _updateText(size) { - let glyphOffset = 0; - let count2 = 0; - for (let axisId = 0; axisId < 2; axisId++) { - const labels = this._labels[axisId]; - if (labels) { - for (let i = 0; i < labels.length; i++) { - count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - } - } - const title = this._titles[axisId]; - if (title) { - count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - } - const heading = this._headings[axisId]; - if (heading) { - count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - } - const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count2 * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for (let axisId = 0; axisId < 2; axisId++) { - if (this._labels[axisId]) { - const width2 = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - set$5(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for (let axisId = 0; axisId < 2; axisId++) { - if (this._titles[axisId]) { - set$8(this._textPosition, 0, 0, 0); - set$8(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale2 = this._titleSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const lineHeight2 = this._font.size * scale2; - this._textOffset[0] -= width2 / 2; - this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for (let axisId = 0; axisId < 2; axisId++) { - if (this._headings[axisId]) { - set$8(this._textPosition, 0, 0, 0); - set$8(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale2 = this._headingSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const lineHeight2 = this._font.size * scale2; - this._textOffset[0] -= width2 / 2; - this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } - } - } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label2 = 0; label2 < labels.length; label2++) { - const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight2 = scales2[label2]; - const scale2 = lineHeight2 / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$8(this._textPosition, (position2 - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width2 / 2; - } else { - this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; - maxSize[0] = Math.max(width2, maxSize[0]); - maxSize[1] = Math.max(lineHeight2, maxSize[1]); - break; - case AxesTextOrientation.perpendicular: - set$8(this._textPosition, 0, (position2 - 0.5) * size, 0); - this._textOffset[0] = -width2 / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } else { - this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - } - maxSize[0] = Math.max(lineHeight2, maxSize[0]); - maxSize[1] = Math.max(width2, maxSize[1]); - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label2); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - } - return glyphOffset; - } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label2 = 0; label2 < labels.length; label2++) { - const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight2 = scales2[label2]; - const scale2 = lineHeight2 / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const maxGlyphTop = this._textMetric.maxTop * scale2; - const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$8(this._textPosition, (0.5 - position2) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width2 / 2; - } else { - this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; - break; - case AxesTextOrientation.perpendicular: - set$8(this._textPosition, 0, (0.5 - position2) * size, 0); - this._textOffset[0] = -width2 / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } else { - this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; - } - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label2); - TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); - glyphOffset += text2.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset2) { - this._gridTicksIndexOffsets[axisId] = offset2 * 6; - if (this._gridTicksPositions[axisId]) { - const axes = create$6(); - const positions2 = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset2 * 4; - for (let position2 = 0; position2 < positions2.length - 1; position2++) { - const left = isAxisReversed ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const right = isAxisReversed ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId] = position2 + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset2 * 6; - for (let j = 0; j < this._indexTemplate.length; j++) { - indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - } - set$7(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset2++; - } - } - this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; - return offset2; - } - _updateGridFace(axisId, faceId, dataView, indices, offset2) { - set$8(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset2 * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = create$6(); - negate(this._normal, Quad$3.FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for (let position2 = 0; position2 < positions2.length - 1; position2++) { - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset2 * 4; - for (let position3 = 0; position3 < positions3.length - 1; position3++) { - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset2 * 6; - for (let i = 0; i < this._indexTemplate.length; i++) { - indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - } - set$7(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset2++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; - return offset2; - } - } - class Glyph { - toJSON() { - return { - key: this.key, - char: this.char, - width: this.width, - height: this.height, - top: this.top, - left: this.left, - advance: this.advance, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; - } - } - let FontVisual$2 = class FontVisual { - update() { - } - constructor(font2) { - this.font = font2; - } - }; - class Font { - get atlas() { - return this._rasterizer.fontAtlas; - } - get count() { - return this._chars.size; - } - constructor(core, rasterizer) { - this._core = core; - this._rasterizer = rasterizer; - this._chars = /* @__PURE__ */ new Set(); - this._previousSize = 0; - this.glyphs = {}; - } - addGlyph(char) { - if (!this._chars.has(char)) { - this._chars.add(char); - this._rasterizer.draw(char); - this._hasChanged = true; - } - } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); - this._previousSize = this._chars.size; - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - } - } - toJSON() { - const glyphs = []; - for (let key2 in this.glyphs) { - const glyph = this.glyphs[key2]; - glyphs.push(glyph.toJSON()); - } - return { - name: this.name, - size: this.size, - border: this.border, - glyphs, - edgeValue: this.edgeValue - }; - } - } - class FontAtlas { - constructor(width2, height2) { - const canvas = document.createElement("canvas"); - canvas.width = width2; - canvas.height = height2; - const context2 = canvas.getContext("2d"); - context2.clearRect(0, 0, width2, height2); - this.imageData = context2.getImageData(0, 0, width2, height2); - this.x = 0; - this.top = new Uint16Array(width2); - } - } - class FontRasterizer { - get font() { - return this._font; - } - get fontAtlas() { - return this._fontAtlas; - } - constructor(core, options2) { - let start = performance.now(); - this._core = core; - this._fontAtlas = options2.fontAtlas; - this._fontSize = options2.fontSize; - this._border = options2.border; - this._fontFamily = options2.fontFamily; - this._fontWeight = options2.fontWeight; - this._fontStyle = options2.fontStyle; - this._baseline = options2.baseline; - this._maxDistance = options2.maxDistance; - this._edgeValue = options2.edgeValue; - this._font = new Font(core, this); - this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); - this._font.size = this._fontSize; - this._font.border = this._border; - this._font.edgeValue = this._edgeValue; - const glyphRasterizerOptions = { - baseline: this._baseline, - border: this._border, - edgeValue: this._edgeValue, - fontFamily: this._fontFamily, - fontSize: this._fontSize, - fontStyle: this._fontStyle, - fontWeight: this._fontWeight, - maxDistance: this._maxDistance - }; - this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); - this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const glyph = this._glyphRasterizer.draw(char); - const texWidth = glyph.width + 2 * this._border; - const texHeight = glyph.height + 2 * this._border; - const width2 = this._fontAtlas.imageData.width; - const height2 = this._fontAtlas.imageData.height; - if (this._fontAtlas.x + texWidth > width2) { - this._fontAtlas.x = 0; - } - let y2 = 0; - for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { - y2 = Math.max(y2, this._fontAtlas.top[x2]); - } - if (y2 + texHeight > height2) { - this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); - } - for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { - this._fontAtlas.top[x2] = y2 + texHeight; - } - glyph.u0 = this._fontAtlas.x / width2; - glyph.v0 = y2 / height2; - glyph.u1 = (this._fontAtlas.x + texWidth) / width2; - glyph.v1 = (y2 + texHeight) / height2; - this._font.glyphs[char] = glyph; - for (let i = 0; i < glyph.distances.length; i++) { - const distance2 = glyph.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset2 = (this._fontAtlas.x + dataX + (y2 + dataY) * width2) * 4; - this._fontAtlas.imageData.data[offset2 + 0] = distance2; - this._fontAtlas.imageData.data[offset2 + 1] = distance2; - this._fontAtlas.imageData.data[offset2 + 2] = distance2; - this._fontAtlas.imageData.data[offset2 + 3] = 255; - } - this._fontAtlas.x += texWidth; - } - } - class GlyphRasterizer { - constructor(core, options2) { - let start = performance.now(); - this._core = core; - this._fontSize = options2.fontSize; - this._border = options2.border; - this._fontFamily = options2.fontFamily; - this._fontWeight = options2.fontWeight; - this._fontStyle = options2.fontStyle; - this._baseline = options2.baseline; - this._maxDistance = options2.maxDistance; - this._edgeValue = options2.edgeValue; - this._size = this._fontSize + this._border * 2; - this._size += this._border * 2; - this._gridOuter = new Float64Array(this._size * this._size); - this._gridInner = new Float64Array(this._size * this._size); - this._f = new Float64Array(this._size); - this._z = new Float64Array(this._size + 1); - this._v = new Uint16Array(this._size); - const canvas = document.createElement("canvas"); - canvas.width = canvas.height = this._size; - this._context = canvas.getContext("2d", { willReadFrequently: true }); - this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; - this._context.textBaseline = this._baseline; - this._context.textAlign = "left"; - this._context.fillStyle = "black"; - this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const textMetrics2 = this._context.measureText(char); - const glyphLeft = 0; - const glyphTop = Math.floor(textMetrics2.actualBoundingBoxAscent); - let glyphWidth = Math.ceil(textMetrics2.actualBoundingBoxRight); - let glyphHeight = Math.ceil(textMetrics2.actualBoundingBoxAscent) + Math.ceil(textMetrics2.actualBoundingBoxDescent); - glyphWidth = Math.min(this._size - this._border, glyphWidth); - glyphHeight = Math.min(this._size - this._border, glyphHeight); - const width2 = glyphWidth + 2 * this._border; - const height2 = glyphHeight + 2 * this._border; - const length2 = width2 * height2; - const distances = new Uint8ClampedArray(length2); - const gradientsX = new Uint8ClampedArray(length2); - const gradientsY = new Uint8ClampedArray(length2); - const pixels = new Uint8ClampedArray(length2); - const glyph = new Glyph(); - glyph.char = char; - glyph.key = char.codePointAt(0); - glyph.distances = distances; - glyph.gradientsX = gradientsX; - glyph.gradientsY = gradientsY; - glyph.pixels = pixels; - glyph.width = glyphWidth; - glyph.height = glyphHeight; - glyph.top = glyphTop; - glyph.left = glyphLeft; - glyph.advance = textMetrics2.width; - if (glyphWidth == 0 || glyphHeight == 0) { - return glyph; - } - this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); - this._context.fillText(char, this._border, this._border + glyphTop); - const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); - for (let i = 0; i < length2; i++) { - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for (let y2 = 0; y2 < glyphHeight; y2++) { - for (let x2 = 0; x2 < glyphWidth; x2++) { - const a2 = imgData.data[4 * (y2 * glyphWidth + x2) + 3] / 255; - if (a2 > 0) { - const j = (y2 + this._border) * width2 + x2 + this._border; - if (a2 == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - } else { - const d2 = 0.5 - a2; - this._gridOuter[j] = d2 > 0 ? d2 * d2 : 0; - this._gridInner[j] = d2 < 0 ? d2 * d2 : 0; - pixels[j] = 255; - } - } - } - } - this._edt(this._gridOuter, 0, 0, width2, height2, width2, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width2, this._f, this._v, this._z); - const distances2 = new Float32Array(length2); - for (let i = 0; i < length2; i++) { - const distance2 = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance2 * 255 / this._maxDistance); - distances2[i] = distance2; - } - for (let i = 0; i < length2; i++) { - const x2 = i % width2; - const y2 = Math.floor(i / width2); - const d2 = distances2[i]; - const sign2 = d2 < 0 ? -1 : 1; - const x02 = x2 > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x12 = x2 < width2 - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y02 = y2 > 0 ? distances2[i - width2] : Number.MAX_VALUE; - const y12 = y2 < height2 - 1 ? distances2[i + width2] : Number.MAX_VALUE; - let gradientX = sign2 * x02 < sign2 * x12 ? d2 - x02 : x12 - d2; - let gradientY = sign2 * y02 < sign2 * y12 ? y02 - d2 : d2 - y12; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 255); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 255); - } - return glyph; - } - _edt(data2, x02, y02, width2, height2, gridSize, f, v, z2) { - for (let x2 = x02; x2 < x02 + width2; x2++) - this._edt1d(data2, y02 * gridSize + x2, gridSize, height2, f, v, z2); - for (let y2 = y02; y2 < y02 + height2; y2++) - this._edt1d(data2, y2 * gridSize + x02, 1, width2, f, v, z2); - } - _edt1d(grid2, offset2, stride, n, f, v, z2) { - v[0] = 0; - z2[0] = -Number.MAX_VALUE; - z2[1] = Number.MAX_VALUE; - f[0] = grid2[offset2]; - for (let q = 1, k = 0, s2 = 0; q < n; q++) { - f[q] = grid2[offset2 + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s2 = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - } while (s2 <= z2[k] && --k > -1); - k++; - v[k] = q; - z2[k] = s2; - z2[k + 1] = Number.MAX_VALUE; - } - for (let q = 0, k = 0; q < n; q++) { - while (z2[k + 1] < q) { - k++; - } - const r = v[k]; - const qr = q - r; - grid2[offset2 + q * stride] = f[r] + qr * qr; - } - } - } - class ManipulationProcessor { - get manipulators() { - return this._manipulators; - } - get count() { - return this._count; - } - get isDragging() { - return this._isDragging; - } - constructor(core) { - this._core = core; - this._count = 0; - this._centroid = create$6(); - this._previousCentroid = create$6(); - this._relativePositionToCentroid = create$6(); - this._directionToCentroid = create$6(); - this._previousDirectionToCentroid = create$6(); - this._manipulators = {}; - this._removedManipulators = []; - this.cumulativeTranslation = create$6(); - this.translationDelta = create$6(); - this.centroid = create$6(); - this.maxScale = Number.MAX_VALUE; - this.twistAxis = fromValues$3(0, 0, 1); - this.initialize(); - } - update(elapsedTime, manipulators) { - for (const key2 in this._manipulators) { - const manipulator = this._manipulators[key2]; - if (!manipulators[manipulator.id]) { - if (this.removeManipulator) { - this.removeManipulator(manipulator); - } - this._removedManipulators.push(manipulator.id); - } - } - if (this._removedManipulators.length > 0) { - for (let i = 0; i < this._removedManipulators.length; i++) { - delete this._manipulators[this._removedManipulators[i]]; - this._count--; - } - this._removedManipulators = []; - } - for (const key2 in manipulators) { - const manipulator = manipulators[key2]; - if (!this._manipulators[manipulator.id]) { - if (!this.addManipulator || this.addManipulator(manipulator)) { - copy$6(manipulator.initialPosition, manipulator.position); - this._manipulators[manipulator.id] = manipulator; - this._count++; - } - } - } - set$8(this.translationDelta, 0, 0, 0); - this.scaleDelta = 0; - this.twistDelta = 0; - if (this._count > 0) { - if (this._previousCount > 0) { - if (this.prepareManipulation) { - this.prepareManipulation(); - } - this._process(); - if (this.processManipulation) { - this.processManipulation(elapsedTime); - } - } else { - this.initialize(); - if (this.beginManipulation) { - this.beginManipulation(); - } - } - } else { - if (this._previousCount > 0) { - if (this.endManipulation) { - this.endManipulation(); - } - } - } - this._isDragging = this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; - this._previousCount = this._count; - } - initialize() { - set$8(this.centroid, 0, 0, 0); - set$8(this.cumulativeTranslation, 0, 0, 0); - this.cumulativeScale = 1; - this.cumulativeTwist = 0; - } - _process() { - if (this._previousCount > 0) { - let persisted = 0; - for (const key2 in this._manipulators) { - const manipulator = this._manipulators[key2]; - if (manipulator.isPersisted) { - persisted++; - } - } - const removed = this._previousCount - persisted; - if (persisted > 0) { - if (removed > 0) { - copy$6(this._centroid, this._previousCentroid); - } else { - set$8(this._centroid, 0, 0, 0); - for (const key2 in this._manipulators) { - const manipulator = this._manipulators[key2]; - if (manipulator.isPersisted) { - add$4(this._centroid, this._centroid, manipulator.position); - } - } - scale$5(this._centroid, this._centroid, 1 / persisted); - } - for (const key2 in this._manipulators) { - const manipulator = this._manipulators[key2]; - if (manipulator.isPersisted) { - manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); - add$4(this.translationDelta, this.translationDelta, manipulator.position); - subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); - subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); - const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); - if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) { - this.scaleDelta += 1; - } else { - const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); - const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); - const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); - this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; - scale$5(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); - scale$5(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); - this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); - } - } - } - scale$5(this.translationDelta, this.translationDelta, 1 / persisted); - add$4(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); - this.scaleDelta /= persisted; - this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); - this.scaleDelta -= 1; - this.twistDelta /= persisted; - this.cumulativeTwist += this.twistDelta; - } - } - set$8(this.centroid, 0, 0, 0); - for (const key2 in this._manipulators) { - const manipulator = this._manipulators[key2]; - add$4(this.centroid, this.centroid, manipulator.position); - } - scale$5(this.centroid, this.centroid, 1 / this._count); - for (const key2 in this._manipulators) { - const manipulator = this._manipulators[key2]; - subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); - } - copy$6(this._previousCentroid, this.centroid); - for (const key2 in this._manipulators) { - const manipulator = this._manipulators[key2]; - manipulator.isPersisted = true; - copy$6(manipulator.previousPosition, manipulator.position); - copy$6(manipulator.previousRotationAxis, manipulator.rotationAxis); - copy$6(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); - } - } - } - class MouseWheel { - constructor(core) { - this._core = core; - this._previousTotal = 0; - this.total = 0; - } - initialize(element2) { - element2.addEventListener("wheel", (e) => { - e.preventDefault(); - const wheelEvent = e; - this.total += wheelEvent.deltaY; - }, { passive: false }); - } - update(elapsedTime) { - const total = this.total; - this.delta = total - this._previousTotal; - this._previousTotal = total; - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); - } - } - } - class Manipulator { - constructor() { - this.pickedIndex = 0; - this.maxTranslationSquared = 0; - this.initialPosition = create$6(); - this.position = create$6(); - this.previousPosition = create$6(); - this.holdOrigin = create$6(); - this.positionRelativeToCentroid = create$6(); - this.previousPositionRelativeToCentroid = create$6(); - this.rotationAxis = create$6(); - this.previousRotationAxis = create$6(); - } - } - class Pointers { - get hoverX() { - return this._hoverX; - } - get hoverY() { - return this._hoverY; - } - get hoverId() { - return this._hoverId; - } - constructor(core, manipulators) { - this._core = core; - this._manipulators = manipulators; - } - initialize(element2) { - this._element = element2; - element2.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); - element2.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); - element2.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); - element2.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); - element2.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); - element2.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); - } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); - this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); - } - } - _handlePointerDown(e) { - this._element.focus(); - const devicePixelRatio2 = this._core.renderer.devicePixelRatio; - const manipulator = new Manipulator(); - const id2 = e.pointerId; - const x2 = e.offsetX * devicePixelRatio2; - const y2 = e.offsetY * devicePixelRatio2; - manipulator.id = id2; - manipulator.position[0] = x2; - manipulator.position[1] = y2; - manipulator.type = e.pointerType; - manipulator.button = e.button; - manipulator.shiftKey = e.shiftKey; - manipulator.ctrlKey = e.ctrlKey; - manipulator.altKey = e.altKey; - manipulator.event = e; - this._manipulators[id2] = manipulator; - this._hoverId = id2; - this._hoverX = x2; - this._hoverY = y2; - } - _handlePointerMove(e) { - const devicePixelRatio2 = this._core.renderer.devicePixelRatio; - const x2 = e.offsetX * devicePixelRatio2; - const y2 = e.offsetY * devicePixelRatio2; - const id2 = e.pointerId; - const manipulator = this._manipulators[id2]; - if (manipulator) { - manipulator.position[0] = x2; - manipulator.position[1] = y2; - manipulator.event = e; - } - switch (e.pointerType) { - case "mouse": - this._hoverId = id2; - this._hoverX = x2; - this._hoverY = y2; - break; - case "pen": - this._hoverId = id2; - this._hoverX = x2; - this._hoverY = y2; - this._tiltX = e.tiltX; - this._tiltY = e.tiltY; - this._twist = e.twist; - break; - } - } - _handlePointerUp(e) { - const manipulator = this._manipulators[e.pointerId]; - if (manipulator) { - manipulator.event = e; - } - this._remove(e.pointerId); - } - _handlePointerCancel(e) { - this._remove(e.pointerId); - } - _handlePointerLeave(e) { - this._resetHover(); - this._remove(e.pointerId); - } - _handlePointerOut(e) { - this._resetHover(); - this._remove(e.pointerId); - } - _resetHover() { - this._hoverId = null; - this._hoverX = null; - this._hoverY = null; - } - _remove(pointerId) { - const manipulator = this._manipulators[pointerId]; - if (manipulator) { - delete this._manipulators[pointerId]; - } - } - } - class AnimationHelper { - static smoothStep(value2) { - return value2 * value2 * (3 - 2 * value2); - } - static damp(value2, target2, threshold2, dampening) { - if (Math.abs(target2) < threshold2) { - return MathHelper.lerp(value2, 0, dampening); - } else { - return MathHelper.lerp(value2, target2, dampening); - } - } - } - class Keyboard { - constructor(core) { - this._core = core; - this._pressedKeys = /* @__PURE__ */ new Set(); - this._previousPressedKeys = /* @__PURE__ */ new Set(); - } - initialize(element2) { - element2.addEventListener("keydown", (e) => { - this._handleKeyDown(e); - }, false); - element2.addEventListener("keyup", (e) => { - this._handleKeyUp(e); - }, false); - } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); - } - } - isKeyDown(key2) { - return this._pressedKeys.has(key2); - } - wasKeyReleased(key2) { - if (this._pressedKeys.has(key2)) { - if (!this._previousPressedKeys.has(key2)) { - this._previousPressedKeys.add(key2); - return true; - } - } else { - this._previousPressedKeys.delete(key2); - } - return false; - } - _handleKeyDown(e) { - const keyboardEvent = e; - const key2 = keyboardEvent.key; - if (!this._pressedKeys.has(key2)) { - this._pressedKeys.add(key2); - } - } - _handleKeyUp(e) { - const keyboardEvent = e; - const key2 = keyboardEvent.key; - if (this._pressedKeys.has(key2)) { - this._pressedKeys.delete(key2); - } - } - } - class Manager { - constructor(core) { - this._manipulators = {}; - this._core = core; - this._vec3 = create$6(); - this._manipulationProcessor = new ManipulationProcessor(core); - this._manipulators = {}; - this._pointers = new Pointers(core, this._manipulators); - this._pointers.initialize(core.container); - this._mouseWheel = new MouseWheel(core); - this._mouseWheel.initialize(core.container); - this._keyboard = new Keyboard(core); - this._keyboard.initialize(core.container); - this.isPickingEnabled = true; - this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; - this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; - this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; - this.pickHoldDelay = this._core.config.pickHoldDelay; - this.pickSelectDelay = this._core.config.pickSelectDelay; - const rightButton2 = 2; - this.singleTouchAction = (manipulator) => { - if (manipulator.type == "mouse" && manipulator.button == rightButton2 || manipulator.shiftKey || manipulator.ctrlKey) { - return SingleTouchAction.translate; - } else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton2) { - return SingleTouchAction.lasso; - } else { - return SingleTouchAction.rotate; - } - }; - this.mouseWheelAction = (keyboard) => { - if (this._keyboard.isKeyDown("Control")) { - return MouseWheelAction.rotateY; - } else { - return MouseWheelAction.zoom; - } - }; - this.lassoPickType = PickType.data; - this._thumbstickX = 0; - this._previousControllerButtonPressed = [false, false, false, false]; - this._quat0 = create$4(); - this._quat1 = create$4(); - } - update(elapsedTime, xrFrame) { - if (xrFrame) { - const inputSources = this._core.webXRSession.inputSources; - if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { - const inputSource = inputSources[0]; - const controllerVisual = this._core.renderer.controllers[0]; - if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { - const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); - if (gripPose) { - controllerVisual.mMatrix = gripPose.transform.matrix; - } - const gamepad = inputSource.gamepad; - this._core.renderer.isPickingEnabled = false; - const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); - if (rayPose) { - controllerVisual.rayMMatrix = rayPose.transform.matrix; - if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { - this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; - this._core.renderer.isPickingEnabled = true; - } - } - const threshold2 = 0.2; - const dampening = Math.min(0.015 * elapsedTime, 1); - this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold2, dampening); - if (this._thumbstickX != 0) { - setAxisAngle(this._quat0, Constants$1.VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); - this._core.getModelRotation(this._quat1); - multiply(this._quat1, this._quat0, this._quat1); - this._core.setModelRotation(this._quat1, true); - } - if (gamepad.buttons[2].pressed) { - if (!this._previousControllerButtonPressed[2]) { - this._previousControllerButtonPressed[2] = true; - if (this.controllerButtonPressedCallback) { - this.controllerButtonPressedCallback(2); - } - } - } else { - this._previousControllerButtonPressed[2] = false; - } - } - } - } else { - const camera = this._core.camera; - this._manipulationProcessor.update(elapsedTime, this._manipulators); - this._pointers.update(elapsedTime); - this._mouseWheel.update(elapsedTime); - this._keyboard.update(elapsedTime); - if (this._mouseWheel.delta != 0) { - switch (this.mouseWheelAction(this._keyboard)) { - case MouseWheelAction.zoom: - if (this._pointers.hoverX, this._pointers.hoverY) { - camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); - } - break; - case MouseWheelAction.rotateY: - setAxisAngle(this._quat0, Constants$1.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); - camera.getOrbit(this._quat1); - multiply(this._quat1, this._quat1, this._quat0); - camera.setOrbit(this._quat1, true); - break; - } - } - const count2 = this._manipulationProcessor.count; - if (count2 == 0) { - if (this._isLassoPicking) { - this._isLassoPicking = false; - this._core.renderer.isLassoPicking = false; - const x02 = Math.min(this._lassoX0, this._lassoX1); - const y02 = Math.min(this._lassoY0, this._lassoY1); - const x12 = Math.max(this._lassoX0, this._lassoX1); - const y12 = Math.max(this._lassoY0, this._lassoY1); - if (x12 - x02 > 0 && y12 - y02 > 0) { - const sets = this._core.pickLasso(x02, y02, x12, y12, this.lassoPickType); - const result = { - x0: x02, - y0: y02, - x1: x12, - y1: y12, - pickType: this.lassoPickType, - ids: sets, - manipulator: this._manipulator - }; - this.pickLassoCallback(result); - } - } - } else if (count2 == 1) { - const translationDelta = this._manipulationProcessor.translationDelta; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - const manipulators = this._manipulationProcessor.manipulators; - for (const key2 in manipulators) { - const manipulator = manipulators[key2]; - switch (this.singleTouchAction(manipulator)) { - case SingleTouchAction.rotate: - camera.rotate(translationDelta); - break; - case SingleTouchAction.translate: - camera.translate(translationDelta); - break; - case SingleTouchAction.lasso: - if (this.pickLassoCallback) { - if (!this._isLassoPicking) { - this._isLassoPicking = true; - this._core.renderer.isLassoPicking = true; - this._lassoX0 = manipulator.position[0]; - this._lassoY0 = manipulator.position[1]; - } - this._lassoX1 = manipulator.position[0]; - this._lassoY1 = manipulator.position[1]; - this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); - this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); - } - break; - } - break; - } - } - } else { - const translationDelta = this._manipulationProcessor.translationDelta; - const camera2 = this._core.camera; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - camera2.translate(translationDelta); - } - if (this._manipulationProcessor.scaleDelta != 0) { - const distance2 = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; - camera2.zoom(distance2, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this._manipulationProcessor.twistDelta != 0) { - camera2.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - } - if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { - const camera2 = this._core.camera; - const renderer = this._core.renderer; - if (renderer.isCapturingPickImage) { - camera2.updatePickVMatrix(renderer.width / 2, renderer.height / 2); - renderer.pickVMatrix = camera2.pickVMatrix; - renderer.isPickingEnabled = true; - this._pickedTime = 0; - } else if (this._pointers.hoverId > -1) { - const pickingX = this._pointers.hoverX; - const pickingY = this._pointers.hoverY; - camera2.updatePickVMatrix(pickingX, pickingY); - renderer.pickVMatrix = camera2.pickVMatrix; - renderer.isPickingEnabled = true; - if (this._pickedId != renderer.pickedId) { - this._pickedId = renderer.pickedId; - this._pickedTime = 0; - } else { - if (this._manipulationProcessor.count == 1) { - this._pickedTime += elapsedTime; - for (const key2 in this._manipulators) { - this._manipulator = this._manipulators[key2]; - break; - } - } - } - if (this._pickedTime > 0) { - switch (renderer.pickedType) { - case PickType.data: - if (this._pickedTime > this.pickHoldDelay) { - renderer.getVertexPosition(this._vec3, this._pickedId); - this._core.setModelManipulationOrigin(this._vec3); - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.transitionBuffers.length; i++) { - const transitionBuffer = renderer.transitionBuffers[i]; - const id2 = transitionBuffer.pickIdLookup[this._pickedId]; - if (id2 > -1) { - const result = { - transitionBuffer: i, - id: id2, - manipulator: this._manipulator - }; - this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); - if (this.pickItemCallback) { - this.pickItemCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.label: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.labelSets.length; i++) { - const labelSet = renderer.labelSets[i].label; - const id2 = labelSet.pickIdLookup[this._pickedId]; - if (id2 > -1) { - const result = { - label: id2, - set: i, - manipulator: this._manipulator - }; - this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); - if (this.pickLabelSetCallback) { - this.pickLabelSetCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesDivision: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id2 = axes.pickGridLookup[this._pickedId]; - if (id2 > -1) { - const result = axes.pickGrid(id2); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); - if (this.pickAxesGridCallback) { - this.pickAxesGridCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesTitle: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id2 = axes.pickTitleLookup[this._pickedId]; - if (id2 > -1) { - const result = axes.pickTitle(id2); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); - if (this.pickAxesTitleCallback) { - this.pickAxesTitleCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesLabel: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id2 = axes.pickLabelLookup[this._pickedId]; - if (id2 > -1) { - const result = axes.pickLabel(id2); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); - if (this.pickAxesLabelCallback) { - this.pickAxesLabelCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesHeading: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id2 = axes.pickHeadingLookup[this._pickedId]; - if (id2 > -1) { - const result = axes.pickHeading(id2); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); - if (this.pickAxesHeadingCallback) { - this.pickAxesHeadingCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - } - } - } else { - renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } else { - this._core.renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); - this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); - } - } - } - let Log$1 = class Log { - constructor(core) { - this._core = core; - } - write(level, value2) { - if (level >= this._core.config.logLevel) { - switch (level) { - case LogLevel.trace: - console.trace(value2); - break; - case LogLevel.debug: - console.debug(value2); - break; - case LogLevel.info: - console.info(value2); - break; - case LogLevel.warn: - console.warn(value2); - break; - case LogLevel.error: - console.error(value2); - break; - } - } - } - }; - var __awaiter$4 = function(thisArg, _arguments, P, generator) { - function adopt(value2) { - return value2 instanceof P ? value2 : new P(function(resolve2) { - resolve2(value2); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value2) { - try { - step(generator.next(value2)); - } catch (e) { - reject(e); - } - } - function rejected(value2) { - try { - step(generator["throw"](value2)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - class Core { - get container() { - return this._container; - } - get started() { - return this._started; - } - get debugText() { - return this._debugText; - } - get log() { - return this._log; - } - get totalFrames() { - return this._fps.totalFrames; - } - get camera() { - return this._camera; - } - set camera(value2) { - this._camera = value2; - } - getModelRotation(value2) { - copy$4(value2, this._modelRotation); - } - setModelRotation(value2, isSmooth) { - copy$4(this._modelRotation, value2); - if (!isSmooth) { - copy$4(this._smoothedModelRotation, this._modelRotation); - } - } - getModelScale() { - return this._modelScale[0]; - } - setModelScale(value2, isSmooth) { - set$8(this._modelScale, value2, value2, value2); - if (!isSmooth) { - copy$6(this._smoothedModelScale, this._modelScale); - } - } - getModelManipulationOrigin(value2) { - copy$6(value2, this._modelManipulationOrigin); - } - setModelManipulationOrigin(value2) { - this._updateManipulationOrigin(value2); - } - getModelPosition(value2) { - copy$6(value2, this._modelPosition); - } - setModelPosition(value2, isSmooth) { - copy$6(this._modelPosition, value2); - if (!isSmooth) { - copy$6(this._smoothedModelPosition, this._modelPosition); - } - } - get webXRSession() { - return this._webXRSession; - } - get renderer() { - return this._renderer; - } - set renderer(renderer) { - if (this._renderer == renderer) { - return; - } - if (this._renderer) { - this.stop(); - this._renderer.remove(); - } - if (!renderer.isInitialized) { - renderer.initialize(this); - } - if (this._renderer) { - renderer.transitionTime = this._renderer.transitionTime; - for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { - const previousTransitionBuffer = this._renderer.transitionBuffers[i]; - const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); - transitionBuffer.copyFrom(previousTransitionBuffer); - renderer.transitionBuffers.push(transitionBuffer); - } - const currentAxes = this._renderer.currentAxes; - if (currentAxes) { - renderer.currentAxes = []; - for (let i = 0; i < currentAxes.length; i++) { - const axesVisual = currentAxes[i]; - const axes = axesVisual.axes; - if (axes instanceof Cartesian3dAxes) { - const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); - renderer.currentAxes.push(cartesian3dAxesVisual); - } else if (axes instanceof Cartesian2dAxes) { - renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); - } - } - } - const labelSets = this._renderer.labelSets; - if (labelSets) { - renderer.labelSets = []; - for (let i = 0; i < labelSets.length; i++) { - renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); - } - } - const images = this._renderer.images; - if (images) { - renderer.images = []; - for (let i = 0; i < images.length; i++) { - renderer.images.push(renderer.createImageVisual(images[i].image)); - } - } - const fonts = this._renderer.fonts; - if (fonts) { - for (const key2 in fonts) { - const font2 = fonts[key2].font; - renderer.fonts[font2.name] = renderer.createFontVisual(font2); - } - } - } else { - renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); - } - if (this._renderer) { - this._renderer.finalize(); - } - this._renderer = renderer; - this._fps.reset(); - this.start(); - } - get font() { - return this._font; - } - get paletteResources() { - return this._paletteResources; - } - get config() { - return this._config; - } - get inputManager() { - return this._inputManager; - } - constructor(options2) { - setMatrixArrayType(Array); - this._vec3 = create$6(); - this._quat = create$4(); - this._mat4 = create$7(); - this._container = options2 && options2.container ? options2.container : document.body; - this._config = new Config$2(this); - this._log = new Log$1(this); - this._debugText = new DebugText(); - this._inputManager = options2 && options2.useInputManager === false ? null : new Manager(this); - const fontRasterizerOptions = options2 && options2.fontRasterizerOptions ? options2.fontRasterizerOptions : { - fontAtlas: new FontAtlas(256, 512), - fontSize: 24, - border: 3, - fontFamily: '"segoe ui semibold", sans-serif', - fontWeight: "normal", - fontStyle: "normal", - baseline: "alphabetic", - maxDistance: 8, - edgeValue: 192 - }; - const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); - this._font = fontRasterizer.font; - this._paletteResources = new PaletteResources(); - this._previousTime = 0; - this._fps = new Fps(this); - this._modelMMatrix = create$7(); - this._modelPosition = create$6(); - this._modelRotation = create$4(); - this._modelScale = create$6(); - this._smoothedModelPosition = create$6(); - this._smoothedModelRotation = create$4(); - this._smoothedModelScale = create$6(); - this._modelManipulationOrigin = create$6(); - this._camera = new AltAzimuthCamera(this); - this.resetModel(false); - } - getView(view) { - this.getModelPosition(view.position); - this.getModelRotation(view.rotation); - view.scale = this.getModelScale(); - } - setView(view, isSmooth) { - this.setModelPosition(view.position, isSmooth); - this.setModelRotation(view.rotation, isSmooth); - this.setModelScale(view.scale, isSmooth); - } - lerpView(from, to, time2) { - lerp$1(this._vec3, from.position, to.position, time2); - this.setModelPosition(this._vec3, false); - slerp(this._quat, from.rotation, to.rotation, time2); - this.setModelRotation(this._quat, false); - this.setModelScale(MathHelper.lerp(from.scale, to.scale, time2), false); - } - resetModel(isSmooth) { - set$8(this._modelPosition, 0, 0, -this._config.modelDistance); - set$8(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); - set$6(this._modelRotation, 0, 0, 0, 1); - if (!isSmooth) { - this._syncSmooth(); - } - } - resetManipulationOrigin() { - if (!exactEquals$1(this._modelManipulationOrigin, Constants$1.VECTOR3_ZERO)) { - this._updateManipulationOrigin(Constants$1.VECTOR3_ZERO); - } - } - reset(isSmooth) { - this.resetModel(isSmooth); - this.resetManipulationOrigin(); - this._camera.reset(isSmooth); - } - start() { - if (!this._started && this._renderer) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); - this._started = true; - this._log.write(LogLevel.info, "render loop started"); - if (this.startCallback) { - this.startCallback(); - } - } - } - stop() { - if (this._started) { - this._started = false; - if (this._windowAnimationFrame != null) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - this._log.write(LogLevel.info, "render loop stopped"); - } - if (this.stopCallback) { - this.stopCallback(); - } - } - } - checkWebXRSupport() { - const xrSystem = navigator.xr; - if (xrSystem) { - xrSystem.isSessionSupported("immersive-vr").then((supported) => { - if (supported) { - this._log.write(LogLevel.info, "WebXR supported"); - if (this.webXRSupportedCallback) { - this.webXRSupportedCallback(); - } - } - }); - } - } - requestWebXRSession() { - if (this._webXRSession) { - this._webXRSession.end(); - } else { - navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); - } - } - _webXRSessionStarted(session) { - if (this.webXRSessionStartedCallback) { - this.webXRSessionStartedCallback(); - } - this._webXRSession = session; - session.onend = () => this._webXRSessionEnded(); - this._renderer.initializeWebXR(session).then(() => { - if (this._windowAnimationFrame) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - } - session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); - }); - session.oninputsourceschange = (event2) => this._webXRInputSourcesChanged(event2); - } - _webXRSessionEnded() { - if (this.webXRSessionEndedCallback) { - this.webXRSessionEndedCallback(); - } - this._webXRSession = null; - this._renderer.controllers.length = 0; - this.start(); - } - _webXRInputSourcesChanged(event2) { - if (event2.added.length > 0) { - const added = event2.added[0]; - if (added.targetRayMode == "tracked-pointer") { - const profiles = added.profiles; - const handedness = added.handedness; - if (this.webXRInputSourceRequestCallback) { - this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { - const options2 = { - profiles, - handedness, - obj: response.obj, - texture: response.texture - }; - const controller = new Controller(this, options2); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - }, (e) => { - this._log.write(LogLevel.error, e); - }); - } else { - const options2 = {}; - const controller = new Controller(this, options2); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - } - } - } - if (event2.removed.length > 0) { - this.renderer.controllers.length = 0; - } - } - _tick(currentTime, xrFrame) { - return __awaiter$4(this, void 0, void 0, function* () { - let elapsedTime = currentTime - this._previousTime; - this._previousTime = currentTime; - if (elapsedTime > 0) { - this.update(elapsedTime, xrFrame); - yield this.render(elapsedTime, xrFrame); - } - if (xrFrame) { - xrFrame.session.requestAnimationFrame((currentTime2, xrframe) => this._tick(currentTime2, xrframe)); - } else if (this._started) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime2) => this._tick(currentTime2)); - } - }); - } - update(elapsedTime, xrFrame) { - this._renderer.setSize(elapsedTime); - if (this.updateCallback) { - this.updateCallback(elapsedTime, xrFrame); - } - if (this._config.isDebugVisible) { - this._debugText.clear(); - } - this._fps.update(elapsedTime); - if (this._inputManager) { - this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; - this._inputManager.update(elapsedTime, xrFrame); - } - let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); - lerp$1(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); - amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); - slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); - amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); - lerp$1(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); - fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); - this._renderer.mMatrix = this._modelMMatrix; - if (this._config.isDebugVisible) { - this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); - this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); - this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); - this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); - this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); - this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); - this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); - } - if (!xrFrame) { - this._camera.width = this._renderer.width; - this._camera.height = this._renderer.height; - this._camera.modelMMatrix = this._modelMMatrix; - this._camera.modelPosition = this._smoothedModelPosition; - this._camera.modelRotation = this._smoothedModelRotation; - this._camera.modelScale = this._smoothedModelScale; - this._camera.modelManipulationOrigin = this._modelManipulationOrigin; - this._camera.update(elapsedTime); - this._renderer.vMatrices = this._camera.vMatrices; - this._renderer.mvMatrices = this._camera.mvMatrices; - this._renderer.pMatrices = this._camera.pMatrices; - this._renderer.inverseVMatrices = this._camera.inverseVMatrices; - this._renderer.inversePMatrices = this._camera.inversePMatrices; - } - this._renderer.prepare(xrFrame); - if (!xrFrame && this._config.stereoMode == StereoMode.none) { - this._renderer.pickPMatrix = this._camera.pMatrices[0]; - } else { - const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); - perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); - this._renderer.pickPMatrix = this._mat4; - } - if (this._renderer.isInitialized) { - this._renderer.update(elapsedTime); - } - } - render(elapsedTime, xrFrame) { - return __awaiter$4(this, void 0, void 0, function* () { - this._fps.render(); - if (this._renderer.isInitialized) { - yield this._renderer.render(elapsedTime, xrFrame); - if (this.afterRenderCallback) { - this.afterRenderCallback(); - } - } - }); - } - _syncSmooth() { - copy$6(this._smoothedModelPosition, this._modelPosition); - copy$6(this._smoothedModelScale, this._modelScale); - copy$4(this._smoothedModelRotation, this._modelRotation); - } - _updateManipulationOrigin(position2) { - this._log.write(LogLevel.info, `manipulation origin ${position2[0].toFixed(3)},${position2[1].toFixed(3)},${position2[2].toFixed(3)}`); - this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position2); - copy$6(this._modelManipulationOrigin, position2); - transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); - subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); - copy$6(this._smoothedModelPosition, this._modelPosition); - if (this.manipulationOriginChangedCallback) { - const result = { - x: position2[0], - y: position2[1], - z: position2[2] - }; - this.manipulationOriginChangedCallback(result); - } - } - pickLasso(x02, y02, x12, y12, pickType) { - const inverseMMatrix = create$7(); - invert$1(inverseMMatrix, this._modelMMatrix); - const sets = []; - const nearPositions = [create$6(), create$6(), create$6(), create$6()]; - const farPositions = [create$6(), create$6(), create$6(), create$6()]; - const directions = [create$6(), create$6(), create$6(), create$6()]; - this._camera.unproject(nearPositions[0], x02, y12, -1); - this._camera.unproject(farPositions[0], x02, y12, 1); - this._camera.unproject(nearPositions[1], x12, y12, -1); - this._camera.unproject(farPositions[1], x12, y12, 1); - this._camera.unproject(nearPositions[2], x12, y02, -1); - this._camera.unproject(farPositions[2], x12, y02, 1); - this._camera.unproject(nearPositions[3], x02, y02, -1); - this._camera.unproject(farPositions[3], x02, y02, 1); - for (let i = 0; i < 4; i++) { - transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); - transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); - subtract(directions[i], farPositions[i], nearPositions[i]); - normalize$5(directions[i], directions[i]); - } - const normals = [create$6(), create$6(), create$6(), create$6()]; - const d2 = []; - for (let i = 0; i < 4; i++) { - cross$1(normals[i], directions[(i + 1) % 4], directions[i]); - normalize$5(normals[i], normals[i]); - d2.push(-dot$1(normals[i], nearPositions[i])); - } - if (pickType == PickType.data) { - const translation = create$6(); - for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { - const transitionBuffer = this._renderer.transitionBuffers[i]; - const set2 = /* @__PURE__ */ new Set(); - if (transitionBuffer.isVisible) { - const start = window.performance.now(); - const currentBuffer = transitionBuffer.currentBuffer; - const lookup2 = currentBuffer.lookup; - for (let j = 0; j < currentBuffer.length; j++) { - const id2 = currentBuffer.ids[j]; - const index2 = lookup2[id2]; - if (index2 != null) { - UnitVertex.getTranslation(currentBuffer.dataView, index2, translation); - let isInside = true; - for (let k = 0; k < 4; k++) { - let distance2 = dot$1(normals[k], translation); - distance2 += d2[k]; - if (distance2 < 0) { - isInside = false; - break; - } - } - if (isInside) { - set2.add(id2); - } - } - } - if (set2.size > 0) { - this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set2.size} ${Math.round(window.performance.now() - start)}ms`); - } - } - sets.push(set2); - } - } - return sets; - } - } - const StereoMode = { - none: "none", - split: "split", - anaglyph: "anaglyph", - left: "left", - right: "right" - }; - const HorizontalAlignment = { - left: "left", - center: "center", - right: "right" - }; - const VerticalAlignment = { - top: "top", - center: "center", - bottom: "bottom" - }; - const AxesTextOrientation = { - parallel: "parallel", - perpendicular: "perpendicular" - }; - const AxesVisibility = { - none: "none", - current: "current", - previous: "previous" - }; - const PickType = { - none: 0, - data: 1, - label: 2, - axesDivision: 3, - axesTitle: 4, - axesLabel: 5, - axesHeading: 6 - }; - const Theme = { - dark: "dark", - light: "light" - }; - const HighlightMode = { - luminance: "luminance", - color: "color" - }; - const UnitType = { - block: "block", - blockSdf: "blockSdf", - sphere: "sphere", - sphereSdf: "sphereSdf", - cylinder: "cylinder", - cylinderSdf: "cylinderSdf", - hexPrism: "hexPrism", - hexPrismSdf: "hexPrismSdf", - sdf: "sdf", - disk: "disk", - ringSdf: "ringSdf" - }; - const SingleTouchAction = { - translate: "translate", - rotate: "rotate", - lasso: "lasso" - }; - const MouseWheelAction = { - zoom: "zoom", - rotateY: "rotateY" - }; - const LogLevel = { - trace: 0, - debug: 1, - info: 2, - warn: 3, - error: 4 - }; - const Edge3D = { - topFront: 0, - topRight: 1, - topBack: 2, - bottomRight: 5, - frontRight: 8, - backRight: 9 - }; - const RenderMode = { - color: "color" - }; - let LabelSetVisual$2 = class LabelSetVisual { - render(elapsedTime, xrFrame) { - } - update(elapsedTime) { - } - constructor(labelSet) { - this.label = labelSet; - } - }; - let LabelBase$1 = class LabelBase { - get material() { - return this._material; - } - get vertices() { - return this._vertices; - } - get verticesView() { - return this._verticesView; - } - get indices() { - return this._indices; - } - get indexCount() { - return this._indexCount; - } - get isInitialized() { - return this._isInitialized; - } - get mMatrix() { - return this._mMatrix; - } - get materialType() { - return this._materialType; - } - get materialColor() { - return this._materialColor; - } - get materialFuzz() { - return this._materialFuzz; - } - get materialGloss() { - return this._materialGloss; - } - get segmentColor() { - return this._segmentColor; - } - get scale() { - return this._scale; - } - set scale(value2) { - if (this._scale != value2) { - this._scale = value2; - this._hasChanged = true; - } - } - get font() { - return this._font; - } - set font(value2) { - if (this._font != value2) { - this._font = value2; - this._hasChanged = true; - } - } - get rotation() { - return this._rotation; - } - set rotation(value2) { - if (this._rotation != value2) { - this._rotation = value2; - this._hasChanged = true; - } - } - set reverseX(value2) { - if (this._reverseX != value2) { - this._reverseX = value2; - this._hasChanged = true; - } - } - set reverseY(value2) { - if (this._reverseY != value2) { - this._reverseY = value2; - this._hasChanged = true; - } - } - set reverseZ(value2) { - if (this._reverseZ != value2) { - this._reverseZ = value2; - this._hasChanged = true; - } - } - get horizontalAlignment() { - return this._horizontalAlignment; - } - set horizontalAlignment(value2) { - if (this._horizontalAlignment != value2) { - this._horizontalAlignment = value2; - this._hasChanged = true; - } - } - get verticalAlignment() { - return this._verticalAlignment; - } - set verticalAlignment(value2) { - if (this._verticalAlignment != value2) { - this._verticalAlignment = value2; - this._hasChanged = true; - } - } - get offsetX() { - return this._offsetX; - } - set offsetX(value2) { - if (this._offsetX != value2) { - this._offsetX = value2; - this._hasChanged = true; - } - } - get offsetY() { - return this._offsetY; - } - set offsetY(value2) { - if (this._offsetY != value2) { - this._offsetY = value2; - this._hasChanged = true; - } - } - get offsetZ() { - return this._offsetZ; - } - set offsetZ(value2) { - if (this._offsetZ != value2) { - this._offsetZ = value2; - this._hasChanged = true; - } - } - get maxGlyphTop() { - return this._maxGlyphTop; - } - set maxGlyphTop(value2) { - if (this._maxGlyphTop != value2) { - this._maxGlyphTop = value2; - this._hasChanged = true; - } - } - get maxGlyphHeight() { - return this._maxGlyphHeight; - } - set maxGlyphHeight(value2) { - if (this._maxGlyphHeight != value2) { - this._maxGlyphHeight = value2; - this._hasChanged = true; - } - } - constructor(core, options2) { - this._core = core; - this._offset = create$6(); - this._vec3 = create$6(); - this._vec4 = create$5(); - this._mMatrix = create$7(); - this._indexCount = 0; - this._maxGlyphs = options2.maxGlyphs; - this._textMetric = { width: 0, maxHeight: 0, maxTop: 0 }; - this.scale = options2.scale ? options2.scale : 1; - this.offsetX = options2.offsetX ? options2.offsetX : 0; - this.offsetY = options2.offsetY ? options2.offsetY : 0; - this.offsetZ = options2.offsetZ ? options2.offsetZ : 0; - this.reverseX = options2.reverseX; - this.reverseY = options2.reverseY; - this.reverseZ = options2.reverseZ; - this.rotation = options2.rotation; - this.maxGlyphTop = options2.maxGlyphTop; - this.horizontalAlignment = options2.horizontalAlignment === void 0 ? HorizontalAlignment.center : options2.horizontalAlignment; - this.verticalAlignment = options2.verticalAlignment === void 0 ? VerticalAlignment.center : options2.verticalAlignment; - this._material = options2.material; - this.borderWidth = core.config.textBorderWidth; - this.gamma = 0; - this._materialType = options2.materialType || 0; - this._materialColor = options2.materialColor || core.config.textColor; - this._materialFuzz = options2.materialFuzz || 0; - this._materialGloss = options2.materialGloss || 0; - this._segmentColor = options2.segmentColor; - } - initialize() { - this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); - this._verticesView = new DataView(this._vertices); - this._indices = new Uint32Array(this._maxGlyphs * 6); - this._isInitialized = true; - } - update(elapsedTime) { - } - }; - class LabelSet extends LabelBase$1 { - get materials() { - return this._materials; - } - get materialTypes() { - return this._materialTypes; - } - get materialColors() { - return this._materialColors; - } - get materialFuzzes() { - return this._materialFuzzes; - } - get materialGlosses() { - return this._materialGlosses; - } - get segmentColors() { - return this._segmentColors; - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value2) { - if (this._minBoundsX != value2) { - this._minBoundsX = value2; - this._hasChanged = true; - } - } - get minBoundsY() { - return this._minBoundsY; - } - set minBoundsY(value2) { - if (this._minBoundsY != value2) { - this._minBoundsY = value2; - this._hasChanged = true; - } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value2) { - if (this._minBoundsZ != value2) { - this._minBoundsZ = value2; - this._hasChanged = true; - } - } - get maxBoundsX() { - return this._maxBoundsX; - } - set maxBoundsX(value2) { - if (this._maxBoundsX != value2) { - this._maxBoundsX = value2; - this._hasChanged = true; - } - } - get maxBoundsY() { - return this._maxBoundsY; - } - set maxBoundsY(value2) { - if (this._maxBoundsY != value2) { - this._maxBoundsY = value2; - this._hasChanged = true; - } - } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value2) { - if (this._maxBoundsZ != value2) { - this._maxBoundsZ = value2; - this._hasChanged = true; - } - } - get positionsX() { - return this._positionsX; - } - set positionsX(value2) { - if (this._positionsX != value2) { - this._positionsX = value2; - this._hasChanged = true; - } - } - get positionsY() { - return this._positionsY; - } - set positionsY(value2) { - if (this._positionsY != value2) { - this._positionsY = value2; - this._hasChanged = true; - } - } - get positionsZ() { - return this._positionsZ; - } - set positionsZ(value2) { - if (this._positionsZ != value2) { - this._positionsZ = value2; - this._hasChanged = true; - } - } - get positionScalingX() { - return this._positionScalingX; - } - set positionScalingX(value2) { - if (this._positionScalingX != value2) { - this._positionScalingX = value2; - this._hasChanged = true; - } - } - get positionScalingY() { - return this._positionScalingY; - } - set positionScalingY(value2) { - if (this._positionScalingY != value2) { - this._positionScalingY = value2; - this._hasChanged = true; - } - } - get positionScalingZ() { - return this._positionScalingZ; - } - set positionScalingZ(value2) { - if (this._positionScalingZ != value2) { - this._positionScalingZ = value2; - this._hasChanged = true; - } - } - get rotations() { - return this._rotations; - } - set rotations(value2) { - if (this._rotations != value2) { - this._rotations = value2; - this._hasChanged = true; - } - } - get offsetsX() { - return this._offsetsX; - } - set offsetsX(value2) { - if (this._offsetsX != value2) { - this._offsetsX = value2; - this._hasChanged = true; - } - } - get offsetsY() { - return this._offsetsY; - } - set offsetsY(value2) { - if (this._offsetsY != value2) { - this._offsetsY = value2; - this._hasChanged = true; - } - } - get offsetsZ() { - return this._offsetsZ; - } - set offsetsZ(value2) { - if (this._offsetsZ != value2) { - this._offsetsZ = value2; - this._hasChanged = true; - } - } - get offsetScalingX() { - return this._offsetScalingX; - } - set offsetScalingX(value2) { - if (this._offsetScalingX != value2) { - this._offsetScalingX = value2; - this._hasChanged = true; - } - } - get offsetScalingY() { - return this._offsetScalingY; - } - set offsetScalingY(value2) { - if (this._offsetScalingY != value2) { - this._offsetScalingY = value2; - this._hasChanged = true; - } - } - get offsetScalingZ() { - return this._offsetScalingZ; - } - set offsetScalingZ(value2) { - if (this._offsetScalingZ != value2) { - this._offsetScalingZ = value2; - this._hasChanged = true; - } - } - get text() { - return this._text; - } - set text(value2) { - if (this._text != value2) { - this._text = value2; - this._hasChanged = true; - } - } - get horizontalAlignments() { - return this._horizontalAlignments; - } - set horizontalAlignments(value2) { - if (this._horizontalAlignments != value2) { - this._horizontalAlignments = value2; - this._hasChanged = true; - } - } - get verticalAlignments() { - return this._verticalAlignments; - } - set verticalAlignments(value2) { - if (this._verticalAlignments != value2) { - this._verticalAlignments = value2; - this._hasChanged = true; - } - } - get scales() { - return this._scales; - } - set scales(value2) { - if (this._scales != value2) { - this._scales = value2; - this._hasChanged = true; - } - } - get scalesScaling() { - return this._scalesScaling; - } - set scalesScaling(value2) { - if (this._scalesScaling != value2) { - this._scalesScaling = value2; - this._hasChanged = true; - } - } - constructor(core, options2) { - super(core, options2); - this._quat = create$4(); - this._materials = options2.materials; - this._materialType = options2.materialType; - this._materialColor = options2.materialColors ? null : options2.materialColor || core.config.textColor; - this._materialColors = options2.materialColors; - this.minBoundsX = options2.minBoundsX ? options2.minBoundsX : 0; - this.minBoundsY = options2.minBoundsY ? options2.minBoundsY : 0; - this.minBoundsZ = options2.minBoundsZ ? options2.minBoundsZ : 0; - this.maxBoundsX = options2.maxBoundsX ? options2.maxBoundsX : 1; - this.maxBoundsY = options2.maxBoundsY ? options2.maxBoundsY : 1; - this.maxBoundsZ = options2.maxBoundsZ ? options2.maxBoundsZ : 1; - this._font = options2.font || core.font; - this.text = options2.text; - this.positionsX = options2.positionsX; - this.positionsY = options2.positionsY; - this.positionsZ = options2.positionsZ; - this.positionScalingX = options2.positionScalingX ? options2.positionScalingX : 1; - this.positionScalingY = options2.positionScalingY ? options2.positionScalingY : 1; - this.positionScalingZ = options2.positionScalingZ ? options2.positionScalingZ : 1; - this.rotations = options2.rotations; - this.offsetsX = options2.offsetsX; - this.offsetsY = options2.offsetsY; - this.offsetsZ = options2.offsetsZ; - this.offsetScalingX = options2.offsetScalingX ? options2.offsetScalingX : 1; - this.offsetScalingY = options2.offsetScalingY ? options2.offsetScalingY : 1; - this.offsetScalingZ = options2.offsetScalingZ ? options2.offsetScalingZ : 1; - if (options2.horizontalAlignments) - this.horizontalAlignments = options2.horizontalAlignments; - if (options2.verticalAlignments) - this.verticalAlignments = options2.verticalAlignments; - if (options2.scales) - this.scales = options2.scales; - this.scalesScaling = options2.scalesScaling ? options2.scalesScaling : 1; - } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.pickIdLookup = {}; - if (!this._text) { - this._indexCount = 0; - } else { - const start = window.performance.now(); - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; - const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; - const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; - if (this._rotation) { - set$6(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); - } - let glyphs = 0; - for (let i = 0; i < this._text.length; i++) { - const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; - const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; - const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; - const text2 = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); - const scale2 = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; - TextHelper.measure(this._font, text2, this._textMetric); - const width2 = this._textMetric.width * scale2; - const lineHeight2 = this._font.size * scale2; - const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale2; - const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; - switch (horizontalAlignment) { - case HorizontalAlignment.left: - this._offset[0] = offsetX; - break; - case HorizontalAlignment.center: - this._offset[0] = offsetX - width2 / 2; - break; - case HorizontalAlignment.right: - this._offset[0] = offsetX - width2; - break; - } - const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; - switch (verticalAlignment) { - case VerticalAlignment.top: - this._offset[1] = offsetY - lineHeight2 / 2; - break; - case VerticalAlignment.center: - this._offset[1] = offsetY; - break; - case VerticalAlignment.bottom: - this._offset[1] = offsetY + lineHeight2 / 2; - break; - } - this._offset[1] -= maxGlyphTop / 2; - this._offset[2] = offsetZ; - let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; - let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; - let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; - if (this._reverseX) { - positionX = this.minBoundsX + this.maxBoundsX - positionX; - } - if (this._reverseY) { - positionY = this.minBoundsY + this.maxBoundsY - positionY; - } - if (this._reverseZ) { - positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; - } - set$8(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); - if (this._rotations) { - set$6(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.label, this._vec4); - this.pickIdLookup[pickId] = i; - TextHelper.addString(this._font, text2, this._verticesView, this._indices, glyphs, this._vec3, scale2, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); - glyphs += text2.length; - if (glyphs >= this._maxGlyphs) { - glyphs = this._maxGlyphs; - break; - } - } - this._indexCount = glyphs * 6; - this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - } - } - } - } - let ImageVisual$2 = class ImageVisual { - render(elapsedTime, xrFrame) { - } - update(elapsedTime) { - } - constructor(image2) { - this.image = image2; - } - }; - let ImageBase$1 = class ImageBase { - get material() { - return this._material; - } - get vertices() { - return this._vertices; - } - get indices() { - return this._indices; - } - get indexCount() { - return this._indexCount; - } - get isInitialized() { - return this._isInitialized; - } - get mMatrix() { - return this._mMatrix; - } - get imageData() { - return this._imageData; - } - set imageData(value2) { - if (this._imageData != value2) { - this._imageData = value2; - this._hasChanged = true; - } - } - get rotation() { - return this._rotation; - } - set rotation(value2) { - if (!equals$1(this._rotation, value2)) { - copy$4(this._rotation, value2); - this._hasChanged = true; - } - } - get position() { - return this._position; - } - set position(value2) { - if (!equals$2(this._position, value2)) { - copy$6(this._position, value2); - this._hasChanged = true; - } - } - get texCoord0() { - return this._texCoord0; - } - set texCoord0(value2) { - if (!equals(this._texCoord0, value2)) { - copy$3(this._texCoord0, value2); - this._hasChanged = true; - } - } - get texCoord1() { - return this._texCoord1; - } - set texCoord1(value2) { - if (!equals(this._texCoord1, value2)) { - copy$3(this._texCoord1, value2); - this._hasChanged = true; - } - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value2) { - if (this._minBoundsX != value2) { - this._minBoundsX = value2; - this._hasChanged = true; - } - } - get minBoundsY() { - return this._minBoundsY; - } - set minBoundsY(value2) { - if (this._minBoundsY != value2) { - this._minBoundsY = value2; - this._hasChanged = true; - } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value2) { - if (this._minBoundsZ != value2) { - this._minBoundsZ = value2; - this._hasChanged = true; - } - } - get maxBoundsX() { - return this._maxBoundsX; - } - set maxBoundsX(value2) { - if (this._maxBoundsX != value2) { - this._maxBoundsX = value2; - this._hasChanged = true; - } - } - get maxBoundsY() { - return this._maxBoundsY; - } - set maxBoundsY(value2) { - if (this._maxBoundsY != value2) { - this._maxBoundsY = value2; - this._hasChanged = true; - } - } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value2) { - if (this._maxBoundsZ != value2) { - this._maxBoundsZ = value2; - this._hasChanged = true; - } - } - constructor(core, options2) { - this._core = core; - this._mMatrix = create$7(); - this._origin = create$6(); - this._translation = create$6(); - this._scale = create$6(); - this._transform = create$7(); - this._imageData = options2.imageData; - this._minBoundsX = options2.minBoundsX === void 0 ? 0 : options2.minBoundsX; - this._minBoundsY = options2.minBoundsY === void 0 ? 0 : options2.minBoundsY; - this._minBoundsZ = options2.minBoundsZ === void 0 ? 0 : options2.minBoundsZ; - this._maxBoundsX = options2.maxBoundsX === void 0 ? 1 : options2.maxBoundsX; - this._maxBoundsY = options2.maxBoundsY === void 0 ? 1 : options2.maxBoundsY; - this._maxBoundsZ = options2.maxBoundsZ === void 0 ? 1 : options2.maxBoundsZ; - this._position = options2.position ? clone$4(options2.position) : create$6(); - this._rotation = options2.rotation ? clone$2(options2.rotation) : create$4(); - this._texCoord0 = options2.texCoord0 ? clone$1(options2.texCoord0) : fromValues(0, 0); - this._texCoord1 = options2.texCoord1 ? clone$1(options2.texCoord1) : fromValues(1, 1); - this._material = options2.material === void 0 ? -1 : options2.material; - this._hasChanged = true; - } - }; - class ImageQuad extends ImageBase$1 { - get width() { - return this._width; - } - set width(value2) { - if (this._width != value2) { - this._width = value2; - this._hasChanged = true; - } - } - get height() { - return this._height; - } - set height(value2) { - if (this._height != value2) { - this._height = value2; - this._hasChanged = true; - } - } - constructor(core, options2) { - super(core, options2); - this._width = options2.width === void 0 ? 1 : options2.width; - this._height = options2.height === void 0 ? 1 : options2.height; - this._texTransform = create$7(); - translate$2(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); - scale$6(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); - } - initialize() { - this._vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); - this._indices = Quad$3.INDICES; - this._indexCount = this._indices.length; - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - set$8(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - subtract(this._translation, this._position, this._origin); - scale$5(this._translation, this._translation, boundsScaling); - set$8(this._scale, this._width, this._height, 1); - scale$5(this._scale, this._scale, boundsScaling); - fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); - this._verticesView = Quad$3.normalTextured(this._transform, this._texTransform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - } - } - } - class BoundsHelper { - static rotateBounds(minBounds, maxBounds, rotation2, rotatedMinBounds, rotatedMaxBounds, offset2) { - const sizeX = maxBounds[0] - minBounds[0]; - const sizeY = maxBounds[1] - minBounds[1]; - const sizeZ = maxBounds[2] - minBounds[2]; - const min2 = rotatedMinBounds; - const max2 = rotatedMaxBounds; - set$8(min2, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - set$8(max2, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const vertices = Cube.POSITIONS; - const position2 = create$6(); - for (let i = 0; i < 8; i++) { - set$8(position2, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - add$4(position2, position2, offset2); - transformQuat(position2, position2, rotation2); - subtract(position2, position2, offset2); - min$3(min2, min2, position2); - max$3(max2, max2, position2); - } - add$4(position2, minBounds, maxBounds); - scale$5(position2, position2, 0.5); - add$4(min2, min2, position2); - add$4(max2, max2, position2); - } - static cylinder(pa2, pb, radius2, minBounds, maxBounds) { - const a2 = create$6(); - subtract(a2, pb, pa2); - const aa = dot$1(a2, a2); - const ex = radius2 * Math.sqrt(1 - a2[0] * a2[0] / aa); - const ey = radius2 * Math.sqrt(1 - a2[1] * a2[1] / aa); - const ez = radius2 * Math.sqrt(1 - a2[2] * a2[2] / aa); - minBounds[0] = Math.min(pa2[0] - ex, pb[0] - ex); - minBounds[1] = Math.min(pa2[1] - ey, pb[1] - ey); - minBounds[2] = Math.min(pa2[2] - ez, pb[2] - ez); - maxBounds[0] = Math.max(pa2[0] + ex, pb[0] + ex); - maxBounds[1] = Math.max(pa2[1] + ey, pb[1] + ey); - maxBounds[2] = Math.max(pa2[2] + ez, pb[2] + ez); - } - } - class LayoutBase { - get facetScaling() { - return this._facetScaling; - } - offsetX(facetCoordX) { - return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; - } - offsetY(facetCoordY) { - return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; - } - offsetZ(facetCoordZ) { - return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; - } - constructor(core) { - this._core = core; - this.modelOriginX = 0; - this.modelOriginY = 0; - this.modelOriginZ = 0; - this.minModelBoundsX = 0; - this.minModelBoundsY = 0; - this.minModelBoundsZ = 0; - this.maxModelBoundsX = 0; - this.maxModelBoundsY = 0; - this.maxModelBoundsZ = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._facetSpacingX = 0; - this._facetSpacingY = 0; - this._facetSpacingZ = 0; - this._facetSizeX = 0; - this._facetSizeY = 0; - this._facetSizeZ = 0; - this._facetsX = 1; - this._facetsY = 1; - this._facetsZ = 1; - } - _updateModelBounds(options2) { - this.minModelBoundsX = options2.minBoundsX === void 0 ? this.minLayoutBoundsX : options2.minBoundsX; - this.minModelBoundsY = options2.minBoundsY === void 0 ? this.minLayoutBoundsY : options2.minBoundsY; - this.minModelBoundsZ = options2.minBoundsZ === void 0 ? this.minLayoutBoundsZ : options2.minBoundsZ; - this.maxModelBoundsX = options2.maxBoundsX === void 0 ? this.maxLayoutBoundsX : options2.maxBoundsX; - this.maxModelBoundsY = options2.maxBoundsY === void 0 ? this.maxLayoutBoundsY : options2.maxBoundsY; - this.maxModelBoundsZ = options2.maxBoundsZ === void 0 ? this.maxLayoutBoundsZ : options2.maxBoundsZ; - this._isFacetted = options2.facetsX !== void 0 && options2.facetsX > 1 && options2.facetCoordsX != null || options2.facetsY !== void 0 && options2.facetsY > 1 && options2.facetCoordsY != null || options2.facetsZ !== void 0 && options2.facetsZ > 1 && options2.facetCoordsZ != null; - this._facetSpacingX = options2.facetSpacingX === void 0 ? 0 : options2.facetSpacingX; - this._facetSpacingY = options2.facetSpacingY === void 0 ? 0 : options2.facetSpacingY; - this._facetSpacingZ = options2.facetSpacingZ === void 0 ? 0 : options2.facetSpacingZ; - let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._facetSizeX = modelSizeX; - this._facetSizeY = modelSizeY; - this._facetSizeZ = modelSizeZ; - this._facetsX = options2.facetCoordsX ? options2.facetsX : 1; - this._facetsY = options2.facetCoordsY ? options2.facetsY : 1; - this._facetsZ = options2.facetCoordsZ ? options2.facetsZ : 1; - this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; - this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; - this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; - this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); - this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); - this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); - this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; - this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; - this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; - modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; - this._facetScaling = maxBounds / this._maxBounds; - } - resetCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = void 0; - this.minCumulativeLayoutBoundsY = void 0; - this.minCumulativeLayoutBoundsZ = void 0; - this.maxCumulativeLayoutBoundsX = void 0; - this.maxCumulativeLayoutBoundsY = void 0; - this.maxCumulativeLayoutBoundsZ = void 0; - } - _updateCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === void 0 ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); - this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === void 0 ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); - this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === void 0 ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); - this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === void 0 ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); - this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === void 0 ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); - this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === void 0 ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); - } - unitToModelSize(unitSize) { - return unitSize / this._boundsScaling; - } - unitToModelPositionX(unitPositionX) { - return this.unitToModelSize(unitPositionX) + this.modelOriginX; - } - unitToModelPositionY(unitPositionY) { - return this.unitToModelSize(unitPositionY) + this.modelOriginY; - } - unitToModelPositionZ(unitPositionZ) { - return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; - } - unitToModelPosition(unitPosition, modelPosition) { - modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); - modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); - modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); - } - modelToUnitSize(modelSize) { - return modelSize * this._boundsScaling; - } - modelToUnitPositionX(modelPositionX) { - return (modelPositionX - this.modelOriginX) * this._boundsScaling; - } - modelToUnitPositionY(modelPositionY) { - return (modelPositionY - this.modelOriginY) * this._boundsScaling; - } - modelToUnitPositionZ(modelPositionZ) { - return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; - } - modelToUnitPosition(modelPosition, unitPosition) { - unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); - unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); - unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); - } - inclusiveUnitBounds(buffer, ids, unitType, offset2, count2, minBounds, maxBounds) { - set$8(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - set$8(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const unitScale = create$6(); - const unitRotation = create$4(); - const unitTranslation = create$6(); - const lookup2 = buffer.lookup; - const dataView = buffer.dataView; - let minBounds0; - let maxBounds0; - let minBounds1; - let maxBounds1; - switch (unitType) { - case UnitType.sphere: - case UnitType.sphereSdf: - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const index2 = lookup2[id2]; - UnitVertex.getTranslation(dataView, index2, unitTranslation); - UnitVertex.getScale(dataView, index2, unitScale); - const radius2 = unitScale[0] / 2; - minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius2); - minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius2); - minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius2); - maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius2); - maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius2); - maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius2); - } - break; - case UnitType.hexPrism: - case UnitType.hexPrismSdf: - case UnitType.block: - case UnitType.blockSdf: - minBounds0 = create$6(); - maxBounds0 = create$6(); - minBounds1 = create$6(); - maxBounds1 = create$6(); - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const index2 = lookup2[id2]; - UnitVertex.getTranslation(dataView, index2, unitTranslation); - UnitVertex.getRotation(dataView, index2, unitRotation); - UnitVertex.getScale(dataView, index2, unitScale); - minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; - minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; - minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; - maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; - maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; - maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; - BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants$1.VECTOR3_ZERO); - min$3(minBounds, minBounds, minBounds1); - max$3(maxBounds, maxBounds, maxBounds1); - } - break; - case UnitType.cylinder: - case UnitType.cylinderSdf: - minBounds0 = create$6(); - maxBounds0 = create$6(); - const pa2 = create$6(); - const pb = create$6(); - const identityRotation = Constants$1.VECTOR3_UNITY; - let ca; - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const index2 = lookup2[id2]; - UnitVertex.getTranslation(dataView, index2, unitTranslation); - UnitVertex.getRotation(dataView, index2, unitRotation); - UnitVertex.getScale(dataView, index2, unitScale); - const length2 = unitScale[1]; - const radius2 = Math.max(unitScale[0], unitScale[2]); - if (length2 != 0 && radius2 != 0) { - if (equals$1(unitRotation, Constants$1.QUAT_IDENTITY)) { - ca = identityRotation; - } else { - ca = create$6(); - transformQuat(ca, identityRotation, unitRotation); - } - scaleAndAdd(pa2, unitTranslation, ca, -length2 * 0.5); - scaleAndAdd(pb, unitTranslation, ca, length2 * 0.5); - BoundsHelper.cylinder(pa2, pb, radius2, minBounds0, maxBounds0); - min$3(minBounds, minBounds, minBounds0); - max$3(maxBounds, maxBounds, maxBounds0); - } - } - break; - } - } - } - class Scatter extends LayoutBase { - layout(buffer, ids, options2) { - const start = window.performance.now(); - const offset2 = options2.offset === void 0 ? 0 : options2.offset; - const count2 = options2.count === void 0 ? ids.length : options2.count; - const positionScalingX = options2.positionScalingX === void 0 ? 1 : options2.positionScalingX; - const positionScalingY = options2.positionScalingY === void 0 ? 1 : options2.positionScalingY; - const positionScalingZ = options2.positionScalingZ === void 0 ? 1 : options2.positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const lookup2 = buffer.lookup; - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const index2 = lookup2[id2]; - let positionX = options2.positionsX ? options2.positionsX[id2] * positionScalingX : 0; - let positionY = options2.positionsY ? options2.positionsY[id2] * positionScalingY : 0; - let positionZ = options2.positionsZ ? options2.positionsZ[id2] * positionScalingZ : 0; - this._positions[index2 * 3] = positionX; - this._positions[index2 * 3 + 1] = positionY; - this._positions[index2 * 3 + 2] = positionZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options2) { - const start = window.performance.now(); - const offset2 = options2.offset === void 0 ? 0 : options2.offset; - const count2 = options2.count === void 0 ? ids.length : options2.count; - const dataView = buffer.dataView; - const _vec2 = create$3(); - const _vec3 = create$6(); - const _vec4 = create$5(); - const _quat = create$4(); - const sizeScalingX = options2.sizeScaling === void 0 ? options2.sizeScalingX === void 0 ? 1 : options2.sizeScalingX : options2.sizeScaling; - const sizeScalingY = options2.sizeScaling === void 0 ? options2.sizeScalingY === void 0 ? 1 : options2.sizeScalingY : options2.sizeScaling; - const sizeScalingZ = options2.sizeScaling === void 0 ? options2.sizeScalingZ === void 0 ? 1 : options2.sizeScalingZ : options2.sizeScaling; - const sizesX = options2.sizes ? options2.sizes : options2.sizesX; - const sizesY = options2.sizes ? options2.sizes : options2.sizesY; - const sizesZ = options2.sizes ? options2.sizes : options2.sizesZ; - const minSize = options2.minSize === void 0 ? 0 : options2.minSize; - const minColor = options2.minColor === void 0 ? 0 : options2.minColor; - const maxColor = options2.maxColor === void 0 ? 1 : options2.maxColor; - const minOrder = options2.minOrder === void 0 ? 0 : options2.minOrder; - const maxOrder = options2.maxOrder === void 0 ? 1 : options2.maxOrder; - const orderReverse = options2.orderReverse === void 0 ? false : options2.orderReverse; - const minStaggerOrder = options2.minStaggerOrder === void 0 ? 0 : options2.minStaggerOrder; - const maxStaggerOrder = options2.maxStaggerOrder === void 0 ? 1 : options2.maxStaggerOrder; - const staggerOrderReverse = options2.staggerOrderReverse === void 0 ? false : options2.staggerOrderReverse; - const reverseX = options2.reverseX === void 0 ? false : options2.reverseX; - const reverseY = options2.reverseY === void 0 ? false : options2.reverseY; - const reverseZ = options2.reverseZ === void 0 ? false : options2.reverseZ; - this._updateModelBounds(options2); - if (options2.rotation) { - _quat[0] = options2.rotation[0]; - _quat[1] = options2.rotation[1]; - _quat[2] = options2.rotation[2]; - _quat[3] = options2.rotation[3]; - } else { - rotationTo(_quat, this._core.config.identityRotation, Constants$1.VECTOR3_UNITY); - } - if (options2.texCoord) { - _vec4[0] = options2.texCoord[0]; - _vec4[1] = options2.texCoord[1]; - _vec4[2] = options2.texCoord[2]; - _vec4[3] = options2.texCoord[3]; - } - const lookup2 = buffer.lookup; - const selection = options2.selected && options2.selected.size > 0; - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const index2 = lookup2[id2]; - let positionX = this._positions[index2 * 3]; - let positionY = this._positions[index2 * 3 + 1]; - let positionZ = this._positions[index2 * 3 + 2]; - if (this._isFacetted) { - if (reverseX) { - positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - } - const facetX = options2.facetCoordsX ? options2.facetCoordsX[id2] : 0; - const facetY = options2.facetCoordsY ? options2.facetCoordsY[id2] : 0; - const facetZ = options2.facetCoordsZ ? options2.facetCoordsZ[id2] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) { - positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - UnitVertex.setTranslation(dataView, index2, _vec3); - _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id2]) : 1) * sizeScalingX, minSize) * this._boundsScaling; - _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id2]) : 1) * sizeScalingY, minSize) * this._boundsScaling; - _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id2]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; - UnitVertex.setScale(dataView, index2, _vec3); - if (options2.rotations) { - _quat[0] = options2.rotations[id2 * 4]; - _quat[1] = options2.rotations[id2 * 4 + 1]; - _quat[2] = options2.rotations[id2 * 4 + 2]; - _quat[3] = options2.rotations[id2 * 4 + 3]; - UnitVertex.setRotation(dataView, index2, _quat); - } else { - UnitVertex.setRotation(dataView, index2, _quat); - } - if (options2.colors) { - const size = 1 / (maxColor - minColor + 1); - const color2 = MathHelper.normalize(options2.colors[id2], minColor, maxColor, size / 2, 1 - size / 2); - if (options2.colors1) { - const color1 = MathHelper.normalize(options2.colors1[id2], minColor, maxColor, size / 2, 1 - size / 2); - set$5(_vec2, color2, color1); - } else { - set$5(_vec2, color2, color2); - } - UnitVertex.setColor(dataView, index2, _vec2); - } else { - UnitVertex.setColor(dataView, index2, Constants$1.VECTOR2_ONE); - } - UnitVertex.setIdHover(dataView, index2, options2.hover ? options2.hover[id2] : id2); - UnitVertex.setSelected(dataView, index2, selection ? options2.selected.has(id2) ? 1 : -1 : 0); - if (options2.order !== void 0) { - const order = MathHelper.normalize(options2.order[id2], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else { - _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); - } - if (options2.staggerOrder !== void 0) { - _vec2[1] = options2.staggerOrder; - } else if (options2.staggerOrders) { - const stagger = MathHelper.normalize(options2.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else { - _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); - } - UnitVertex.setOrder(dataView, index2, _vec2); - UnitVertex.setMaterial(dataView, index2, options2.material ? options2.material : options2.materials ? options2.materials[id2] : 0); - UnitVertex.setRounding(dataView, index2, options2.rounding ? options2.rounding * this._boundsScaling : options2.roundings ? options2.roundings[id2] * this._boundsScaling : 0); - UnitVertex.setParameter1(dataView, index2, options2.parameter1 ? options2.parameter1 : options2.parameters1 ? options2.parameters1[id2] : 0); - UnitVertex.setParameter2(dataView, index2, options2.parameter2 ? options2.parameter2 : options2.parameters2 ? options2.parameters2[id2] : 0); - UnitVertex.setSdfBuffer(dataView, index2, options2.sdfBuffer ? options2.sdfBuffer : options2.sdfBuffers ? options2.sdfBuffers[id2] : this._core.config.sdfBuffer); - UnitVertex.setSdfBorder(dataView, index2, options2.sdfBorder ? options2.sdfBorder : options2.sdfBorders ? options2.sdfBorders[id2] : this._core.config.sdfBorder); - if (options2.texCoords) { - _vec4[0] = options2.texCoords[id2 * 4]; - _vec4[1] = options2.texCoords[id2 * 4 + 1]; - _vec4[2] = options2.texCoords[id2 * 4 + 2]; - _vec4[3] = options2.texCoords[id2 * 4 + 3]; - UnitVertex.setTexCoord(dataView, index2, _vec4); - } else { - UnitVertex.setTexCoord(dataView, index2, _vec4); - } - UnitVertex.setMatId(dataView, index2, options2.materialType ? options2.materialType : options2.materialTypes ? options2.materialTypes[id2] : 0); - UnitVertex.setMatColor(dataView, index2, options2.materialColor ? options2.materialColor : options2.materialColors ? [options2.materialColors[id2 * 3], options2.materialColors[id2 * 3 + 1], options2.materialColors[id2 * 3 + 2]] : [0, 0, 0]); - UnitVertex.setMatFuzz(dataView, index2, options2.materialFuzz ? options2.materialFuzz : options2.materialFuzzes ? options2.materialFuzzes[id2] : 0); - UnitVertex.setMatGloss(dataView, index2, options2.materialGloss ? options2.materialGloss : options2.materialGlosses ? options2.materialGlosses[id2] : 0); - UnitVertex.setMatDensity(dataView, index2, options2.materialDensity ? options2.materialDensity : options2.materialDensities ? options2.materialDensities[id2] : 0); - UnitVertex.setMatRefractiveIndex(dataView, index2, options2.materialRefractiveIndex ? options2.materialRefractiveIndex : options2.materialRefractiveIndices ? options2.materialRefractiveIndices[id2] : 0); - UnitVertex.setSegColor(dataView, index2, options2.segmentColor ? options2.segmentColor : options2.segmentColors ? [options2.segmentColors[id2 * 4], options2.segmentColors[id2 * 4 + 1], options2.segmentColors[id2 * 4 + 2], options2.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); - } - buffer.update(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); - } - } - fromValues$3(0.2126, 0.7152, 0.0722); - create$6(); - create$6(); - class PathHelper { - static getFilenameWithoutExtension(path2) { - const dot2 = path2.lastIndexOf("."); - if (dot2 == -1) { - return path2; - } else { - const start = path2.lastIndexOf("/") == -1 ? 0 : path2.lastIndexOf("/") + 1; - return path2.substring(start, dot2); - } - } - static getExtension(path2) { - const dot2 = path2.lastIndexOf("."); - if (dot2 == -1 || dot2 == path2.length - 1) { - return null; - } else { - return path2.substring(dot2 + 1, path2.length); - } - } - static getFilename(path2) { - if (path2.lastIndexOf("/") == -1) { - return path2; - } else { - const start = path2.lastIndexOf("/") + 1; - return path2.substring(start, path2.length); - } - } - static getPath(path2) { - if (path2.lastIndexOf("/") == -1) { - return ""; - } else { - return path2.substring(0, path2.lastIndexOf("/")); - } - } - static combine(first, second2) { - const seperator = first.lastIndexOf("/") == first.length - 1; - if (second2.indexOf("/") == 0) { - if (seperator) { - return first.substring(0, first.length - 1) + second2; - } else { - return first + second2; - } - } else { - if (seperator) { - return first + second2; - } else { - return first + "/" + second2; - } - } - } - } - class TextureHelper { - static create(gl, width2, height2, format2, type2, filter2, bytes, internalFormat = format2) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); - gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width2, height2, 0, format2, type2, bytes); - return texture; - } - static fromImage(gl, image2, mipmaps, filter2) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image2); - if (mipmaps && MathHelper.isPowerOf2(image2.width) && MathHelper.isPowerOf2(image2.height)) - gl.generateMipmap(gl.TEXTURE_2D); - else { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); - } - gl.bindTexture(gl.TEXTURE_2D, null); - return texture; - } - static cubemapFromImages(gl, images) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); - const targets = [ - gl.TEXTURE_CUBE_MAP_POSITIVE_X, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X, - gl.TEXTURE_CUBE_MAP_POSITIVE_Y, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, - gl.TEXTURE_CUBE_MAP_POSITIVE_Z, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Z - ]; - for (let i = 0; i < 6; i++) { - gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - } - gl.generateMipmap(gl.TEXTURE_CUBE_MAP); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); - return texture; - } - } - class Line extends LayoutBase { - layout(buffer, ids, fromIds, toIds, options2) { - const start = window.performance.now(); - const offset2 = options2.offset === void 0 ? 0 : options2.offset; - const count2 = options2.count === void 0 ? ids.length : options2.count; - const positionScalingX = options2.positionScalingX === void 0 ? 1 : options2.positionScalingX; - const positionScalingY = options2.positionScalingY === void 0 ? 1 : options2.positionScalingY; - const positionScalingZ = options2.positionScalingZ === void 0 ? 1 : options2.positionScalingZ; - const sizeScalingX = options2.sizeScaling === void 0 ? options2.sizeScalingX === void 0 ? 1 : options2.sizeScalingX : options2.sizeScaling; - const sizeScalingY = options2.sizeScaling === void 0 ? options2.sizeScalingY === void 0 ? 1 : options2.sizeScalingY : options2.sizeScaling; - const sizeScalingZ = options2.sizeScaling === void 0 ? options2.sizeScalingZ === void 0 ? 1 : options2.sizeScalingZ : options2.sizeScaling; - const minSize = options2.minSize === void 0 ? 0 : options2.minSize; - const offsetScaling = options2.offsetScaling === void 0 ? 1 : options2.offsetScaling; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - this._rotations = new Float32Array(buffer.length * 4); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const _vec3 = create$6(); - const _quat = create$4(); - const direction = create$6(); - const lookup2 = buffer.lookup; - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const fromId = fromIds[id2]; - const toId = toIds[id2]; - const index2 = lookup2[id2]; - let toPositionX = options2.positionsX ? options2.positionsX[toId] * positionScalingX : 0; - let toPositionY = options2.positionsY ? options2.positionsY[toId] * positionScalingY : 0; - let toPositionZ = options2.positionsZ ? options2.positionsZ[toId] * positionScalingZ : 0; - let fromPositionX = options2.positionsX ? options2.positionsX[fromId] * positionScalingX : 0; - let fromPositionY = options2.positionsY ? options2.positionsY[fromId] * positionScalingY : 0; - let fromPositionZ = options2.positionsZ ? options2.positionsZ[fromId] * positionScalingZ : 0; - if (fromId == toId) { - this._sizes[index2 * 3] = 0; - this._sizes[index2 * 3 + 1] = 0; - this._sizes[index2 * 3 + 2] = 0; - this._rotations[index2 * 4] = 0; - this._rotations[index2 * 4 + 1] = 0; - this._rotations[index2 * 4 + 2] = 0; - this._rotations[index2 * 4 + 3] = 1; - } else { - direction[0] = toPositionX - fromPositionX; - direction[1] = toPositionY - fromPositionY; - direction[2] = toPositionZ - fromPositionZ; - let length2 = length$1(direction); - scale$5(direction, direction, 1 / length2); - rotationTo(_quat, this._core.config.identityRotation, direction); - this._rotations[index2 * 4] = _quat[0]; - this._rotations[index2 * 4 + 1] = _quat[1]; - this._rotations[index2 * 4 + 2] = _quat[2]; - this._rotations[index2 * 4 + 3] = _quat[3]; - if (options2.offsets) { - const fromOffset = options2.offsets[fromId] * offsetScaling / 2; - const toOffset = options2.offsets[toId] * offsetScaling / 2; - toPositionX -= direction[0] * toOffset; - toPositionY -= direction[1] * toOffset; - toPositionZ -= direction[2] * toOffset; - fromPositionX += direction[0] * fromOffset; - fromPositionY += direction[1] * fromOffset; - fromPositionZ += direction[2] * fromOffset; - length2 = Math.max(length2 - toOffset - fromOffset, minSize); - } - this._sizes[index2 * 3 + 1] = Math.max(length2 * sizeScalingY, minSize); - if (options2.lineSizes) { - this._sizes[index2 * 3] = Math.max(options2.lineSizes[id2] * sizeScalingX, minSize); - this._sizes[index2 * 3 + 2] = Math.max(options2.lineSizes[id2] * sizeScalingZ, minSize); - } else if (options2.endSizes) { - this._sizes[index2 * 3] = Math.max(options2.endSizes[fromId] * sizeScalingX, minSize); - this._sizes[index2 * 3 + 2] = Math.max(options2.endSizes[toId] * sizeScalingZ, minSize); - } else { - this._sizes[index2 * 3] = sizeScalingX; - this._sizes[index2 * 3 + 2] = sizeScalingZ; - } - } - _vec3[0] = (fromPositionX + toPositionX) / 2; - _vec3[1] = (fromPositionY + toPositionY) / 2; - _vec3[2] = (fromPositionZ + toPositionZ) / 2; - this._positions[index2 * 3] = _vec3[0]; - this._positions[index2 * 3 + 1] = _vec3[1]; - this._positions[index2 * 3 + 2] = _vec3[2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, fromIds, toIds, options2) { - const start = window.performance.now(); - const offset2 = options2.offset === void 0 ? 0 : options2.offset; - const count2 = options2.count === void 0 ? ids.length : options2.count; - const dataView = buffer.dataView; - const _vec2 = create$3(); - const _vec3 = create$6(); - const _quat = create$4(); - const endMinColor = options2.endMinColor === void 0 ? 0 : options2.endMinColor; - const endMaxColor = options2.endMaxColor === void 0 ? 1 : options2.endMaxColor; - const lineMinColor = options2.lineMinColor === void 0 ? 0 : options2.lineMinColor; - const lineMaxColor = options2.lineMaxColor === void 0 ? 1 : options2.lineMaxColor; - const minOrder = options2.minOrder === void 0 ? 0 : options2.minOrder; - const maxOrder = options2.maxOrder === void 0 ? 1 : options2.maxOrder; - const orderReverse = options2.orderReverse === void 0 ? false : options2.orderReverse; - const minStaggerOrder = options2.minStaggerOrder === void 0 ? 0 : options2.minStaggerOrder; - const maxStaggerOrder = options2.maxStaggerOrder === void 0 ? 1 : options2.maxStaggerOrder; - const staggerOrderReverse = options2.staggerOrderReverse === void 0 ? false : options2.staggerOrderReverse; - const reverseX = options2.reverseX === void 0 ? false : options2.reverseX; - const reverseY = options2.reverseY === void 0 ? false : options2.reverseY; - const reverseZ = options2.reverseZ === void 0 ? false : options2.reverseZ; - this._updateModelBounds(options2); - const lookup2 = buffer.lookup; - const selection = options2.selected && options2.selected.size > 0; - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const fromId = fromIds[id2]; - const toId = toIds[id2]; - const index2 = lookup2[id2]; - let positionX = this._positions[index2 * 3]; - let positionY = this._positions[index2 * 3 + 1]; - let positionZ = this._positions[index2 * 3 + 2]; - if (this._isFacetted) { - if (reverseX) { - positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - } - const facetX = options2.facetCoordsX ? options2.facetCoordsX[id2] : 0; - const facetY = options2.facetCoordsY ? options2.facetCoordsY[id2] : 0; - const facetZ = options2.facetCoordsZ ? options2.facetCoordsZ[id2] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) { - positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - UnitVertex.setTranslation(dataView, index2, _vec3); - _vec3[0] = this._sizes[index2 * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index2 * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index2 * 3 + 2] * this._boundsScaling; - UnitVertex.setScale(dataView, index2, _vec3); - _quat[0] = this._rotations[index2 * 4]; - _quat[1] = this._rotations[index2 * 4 + 1]; - _quat[2] = this._rotations[index2 * 4 + 2]; - _quat[3] = this._rotations[index2 * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - UnitVertex.setRotation(dataView, index2, _quat); - let size; - if (options2.endColors) { - size = 1 / (endMaxColor - endMinColor + 1); - const fromColor = MathHelper.normalize(options2.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - const toColor = MathHelper.normalize(options2.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - set$5(_vec2, fromColor, toColor); - UnitVertex.setColor(dataView, index2, _vec2); - } else if (options2.lineColors) { - size = 1 / (lineMaxColor - lineMinColor + 1); - const color2 = MathHelper.normalize(options2.lineColors[id2], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); - set$5(_vec2, color2, color2); - UnitVertex.setColor(dataView, index2, _vec2); - } else { - UnitVertex.setColor(dataView, index2, Constants$1.VECTOR2_ONE); - } - UnitVertex.setIdHover(dataView, index2, options2.hover ? options2.hover[id2] : id2); - UnitVertex.setSelected(dataView, index2, selection ? options2.selected.has(id2) ? 1 : -1 : 0); - if (options2.order !== void 0) { - const order = MathHelper.normalize(options2.order[id2], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else { - _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); - } - if (options2.staggerOrder !== void 0) { - _vec2[1] = options2.staggerOrder; - } else if (options2.staggerOrders) { - const stagger = MathHelper.normalize(options2.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else { - _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); - } - UnitVertex.setOrder(dataView, index2, _vec2); - UnitVertex.setMaterial(dataView, index2, options2.material ? options2.material : options2.materials ? options2.materials[id2] : 0); - UnitVertex.setRounding(dataView, index2, options2.rounding ? options2.rounding * this._boundsScaling : options2.roundings ? options2.roundings[id2] * this._boundsScaling : 0); - UnitVertex.setSdfBuffer(dataView, index2, options2.sdfBuffer ? options2.sdfBuffer : options2.sdfBuffers ? options2.sdfBuffers[id2] : this._core.config.sdfBuffer); - UnitVertex.setSdfBorder(dataView, index2, options2.sdfBorder ? options2.sdfBorder : options2.sdfBorders ? options2.sdfBorders[id2] : this._core.config.sdfBorder); - UnitVertex.setMatId(dataView, index2, options2.materialType ? options2.materialType : options2.materialTypes ? options2.materialTypes[id2] : 0); - UnitVertex.setMatColor(dataView, index2, options2.materialColor ? options2.materialColor : options2.materialColors ? [options2.materialColors[id2 * 3], options2.materialColors[id2 * 3 + 1], options2.materialColors[id2 * 3 + 2]] : [0, 0, 0]); - UnitVertex.setMatFuzz(dataView, index2, options2.materialFuzz ? options2.materialFuzz : options2.materialFuzzes ? options2.materialFuzzes[id2] : 0); - UnitVertex.setMatGloss(dataView, index2, options2.materialGloss ? options2.materialGloss : options2.materialGlosses ? options2.materialGlosses[id2] : 0); - UnitVertex.setMatDensity(dataView, index2, options2.materialDensity ? options2.materialDensity : options2.materialDensities ? options2.materialDensities[id2] : 0); - UnitVertex.setMatRefractiveIndex(dataView, index2, options2.materialRefractiveIndex ? options2.materialRefractiveIndex : options2.materialRefractiveIndices ? options2.materialRefractiveIndices[id2] : 0); - UnitVertex.setSegColor(dataView, index2, options2.segmentColor ? options2.segmentColor : options2.segmentColors ? [options2.segmentColors[id2 * 4], options2.segmentColors[id2 * 4 + 1], options2.segmentColors[id2 * 4 + 2], options2.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); - } - buffer.update(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); - } - } - class AtlasBase { - get imageData() { - return this._imageData; - } - set imageData(value2) { - if (this._imageData != value2) { - this._imageData = value2; - this._changed = true; - } - } - constructor() { - this._imageData = null; - } - copyFrom(atlas) { - if (atlas.imageData) { - this._imageData = atlas.imageData; - this._changed = true; - } else { - this.imageData = null; - } - } - update() { - } - } - let Atlas$2 = class Atlas extends AtlasBase { - }; - class BufferBase { - get isInitialized() { - return this._isInitialized; - } - get ids() { - return this._ids; - } - get dataView() { - return this._dataView; - } - get vertices() { - return this._vertices; - } - get lookup() { - return this._lookup; - } - get length() { - return this._length; - } - get selected() { - return this._selected; - } - constructor(core, ids) { - this._core = core; - this._ids = ids; - this._length = ids.length; - this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); - this._dataView = new DataView(this._vertices); - this._selected = /* @__PURE__ */ new Set(); - this.from = 0; - this.to = 1; - this.unitType = UnitType.block; - this._lookup = {}; - for (let i = 0; i < this._length; i++) { - const id2 = ids[i]; - this._lookup[id2] = i; - UnitVertex.setRotation(this._dataView, i, Constants$1.QUAT_IDENTITY); - } - } - createShared() { - const buffer = Object.create(this); - buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); - buffer._dataView = new DataView(buffer._vertices); - return buffer; - } - copyFrom(buffer) { - const start = window.performance.now(); - const fromDataView = buffer.dataView; - const toDataView = this._dataView; - const lookup2 = buffer.lookup; - for (let i = 0; i < this._length; i++) { - const index2 = lookup2[this._ids[i]]; - if (index2 != null) { - UnitVertex.copyIdHover(fromDataView, index2, toDataView, i); - UnitVertex.copyTranslation(fromDataView, index2, toDataView, i); - UnitVertex.copyScale(fromDataView, index2, toDataView, i); - UnitVertex.copyRotation(fromDataView, index2, toDataView, i); - UnitVertex.copyColor(fromDataView, index2, toDataView, i); - UnitVertex.copySelected(fromDataView, index2, toDataView, i); - UnitVertex.copyMaterial(fromDataView, index2, toDataView, i); - UnitVertex.copyRounding(fromDataView, index2, toDataView, i); - UnitVertex.copyOrder(fromDataView, index2, toDataView, i); - UnitVertex.copyTexCoord(fromDataView, index2, toDataView, i); - UnitVertex.copyTexture(fromDataView, index2, toDataView, i); - UnitVertex.copySdfBuffer(fromDataView, index2, toDataView, i); - UnitVertex.copySdfBorder(fromDataView, index2, toDataView, i); - UnitVertex.copyParameter1(fromDataView, index2, toDataView, i); - UnitVertex.copyParameter2(fromDataView, index2, toDataView, i); - UnitVertex.copyMatId(fromDataView, index2, toDataView, i); - UnitVertex.copyMatColor(fromDataView, index2, toDataView, i); - UnitVertex.copyMatFuzz(fromDataView, index2, toDataView, i); - UnitVertex.copyMatRefractiveIndex(fromDataView, index2, toDataView, i); - UnitVertex.copyMatGloss(fromDataView, index2, toDataView, i); - UnitVertex.copyMatDensity(fromDataView, index2, toDataView, i); - UnitVertex.copySegColor(fromDataView, index2, toDataView, i); - } else { - UnitVertex.setRotation(toDataView, i, Constants$1.QUAT_IDENTITY); - } - } - this.unitType = buffer.unitType; - this._selected = buffer.selected; - this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - update() { - } - updateSelection(options2) { - const start = window.performance.now(); - const ids = options2 && options2.ids ? options2.ids : this._ids; - const offset2 = options2 && options2.offset !== void 0 ? options2.offset : 0; - const count2 = options2 && options2.count !== void 0 ? options2.count : ids.length; - const selection = this._selected.size > 0; - const dataView = this._dataView; - for (let i = 0; i < count2; i++) { - const id2 = ids[i + offset2]; - const index2 = this._lookup[id2]; - UnitVertex.setSelected(dataView, index2, selection ? this._selected.has(id2) ? 1 : -1 : 0); - } - this.update(); - this._core.log.write(LogLevel.info, `buffer update selection ${count2} ${Math.round(window.performance.now() - start)}ms`); - } - } - class TransitionBufferBase { - get pickIdLookup() { - return this._pickIdLookup; - } - get currentBuffer() { - return this._isBuffer1Current ? this._buffer1 : this._buffer2; - } - get previousBuffer() { - return this._isBuffer1Current ? this._buffer2 : this._buffer1; - } - get currentPalette() { - return this._isBuffer1Current ? this._palette1 : this._palette2; - } - get previousPalette() { - return this._isBuffer1Current ? this._palette2 : this._palette1; - } - get currentAtlas() { - return this._isBuffer1Current ? this._atlas1 : this._atlas2; - } - get previousAtlas() { - return this._isBuffer1Current ? this._atlas2 : this._atlas1; - } - get isInitialized() { - return this._isInitialized; - } - get length() { - return this._length; - } - constructor(core, ids, bufferType, paletteType, atlasType) { - this.bufferType = bufferType; - this.paletteType = paletteType; - this.atlasType = atlasType; - this._core = core; - this._length = ids.length; - this.id = TransitionBufferBase._id++; - this.isVisible = true; - this.transitionTime = 1; - this.activeId = -1; - const start = window.performance.now(); - this._buffer1 = new bufferType(core, ids); - this._buffer2 = this._buffer1.createShared(); - this._palette1 = new paletteType(); - this._palette2 = new paletteType(); - this._atlas1 = new atlasType(); - this._atlas2 = new atlasType(); - this.isPickingEnabled = true; - this._pickIdLookup = {}; - const dataView1 = this._buffer1.dataView; - const dataView2 = this._buffer2.dataView; - const _vec4 = create$5(); - this.idColors = new Float32Array(this._length * 4); - this._buffer1.idColors = this.idColors; - this._buffer2.idColors = this.idColors; - for (let i = 0; i < this._length; i++) { - const id2 = ids[i]; - const pickId = PickHelper.nextPickId(); - this._pickIdLookup[pickId] = id2; - PickHelper.encodeNumber(pickId, PickType.data, _vec4); - this.idColors[i * 4] = _vec4[0]; - this.idColors[i * 4 + 1] = _vec4[1]; - this.idColors[i * 4 + 2] = _vec4[2]; - this.idColors[i * 4 + 3] = _vec4[3]; - UnitVertex.setIdColor(dataView1, i, _vec4); - UnitVertex.setIdColor(dataView2, i, _vec4); - } - this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - swap() { - this._isBuffer1Current = !this._isBuffer1Current; - } - copyFrom(transitionBuffer) { - const start = window.performance.now(); - this.key = transitionBuffer.key; - this.isVisible = transitionBuffer.isVisible; - this.transitionTime = transitionBuffer.transitionTime; - this.isPickingEnabled = transitionBuffer.isPickingEnabled; - this.unitType = transitionBuffer.unitType; - this.activeId = transitionBuffer.activeId; - this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); - this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); - this.currentBuffer.update(); - this.previousBuffer.update(); - this.currentPalette.copyFrom(transitionBuffer.currentPalette); - this.previousPalette.copyFrom(transitionBuffer.previousPalette); - this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); - this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); - this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } - TransitionBufferBase._id = 1; - let Buffer$3 = class Buffer extends BufferBase { - constructor(core, ids) { - super(core, ids); - } - }; - let TransitionBuffer$2 = class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids) { - super(core, ids, Buffer$3, Palette$3, Atlas$2); - } - }; - class DebugAxes { - get vertices() { - return this._vertices; - } - get indices() { - return this._indices; - } - get indexCount() { - return this._indexCount; - } - get isInitialized() { - return this._isInitialized; - } - initialize() { - let vertexOffset = 0; - let indexOffset = 0; - const axisVertices = Cube.POSITIONS; - const axisIndices2 = Cube.INDICES; - this._vertices = new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); - const verticesView = new DataView(this._vertices); - this._indices = new Uint16Array(3 * axisIndices2.length + 4); - const vertexCount = axisVertices.length / PositionVertex.SIZE; - const indexCount = axisIndices2.length; - const transform2 = create$7(); - const length2 = 1; - const width2 = 0.01; - transform2[0] = length2; - transform2[5] = width2; - transform2[10] = width2; - transform2[12] = 0.5; - transform2[13] = 0; - transform2[14] = 0; - this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITX, transform2, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; - transform2[0] = width2; - transform2[5] = length2; - transform2[10] = width2; - transform2[12] = 0; - transform2[13] = 0.5; - transform2[14] = 0; - this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITY, transform2, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; - transform2[0] = width2; - transform2[5] = width2; - transform2[10] = length2; - transform2[12] = 0; - transform2[13] = 0; - transform2[14] = 0.5; - this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITZ, transform2, vertexOffset, indexOffset); - this._indexCount = this._indices.length; - this._isInitialized = true; - } - update(elapsedTime) { - } - _createAxis(axisVertices, axisIndices2, verticesView, indices, color2, transform2, vertexOffset, indexOffset) { - const position2 = create$6(); - const vertexCount = axisVertices.length / PositionVertex.SIZE; - const indexCount = axisIndices2.length; - for (let i = 0; i < vertexCount; i++) { - set$8(position2, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); - transformMat4$2(position2, position2, transform2); - PositionColorVertex.setPosition(verticesView, vertexOffset + i, position2); - PositionColorVertex.setColor(verticesView, vertexOffset + i, color2); - } - for (let i = 0; i < indexCount; i++) { - indices[indexOffset + i] = axisIndices2[i] + vertexOffset; - } - } - } - var __awaiter$3 = function(thisArg, _arguments, P, generator) { - function adopt(value2) { - return value2 instanceof P ? value2 : new P(function(resolve2) { - resolve2(value2); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value2) { - try { - step(generator.next(value2)); - } catch (e) { - reject(e); - } - } - function rejected(value2) { - try { - step(generator["throw"](value2)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - class RendererConfig { - reset() { - } - } - class RendererBase { - get isInitialized() { - return this._isInitialized; - } - get config() { - return this._config; - } - get devicePixelRatio() { - return this._devicePixelRatio; - } - get width() { - return this._canvas.width; - } - set width(value2) { - this._options.width = value2; - } - get height() { - return this._canvas.height; - } - set height(value2) { - this._options.height = value2; - } - get webXRReferenceSpace() { - return this._webXRReferenceSpace; - } - get pickedType() { - return this._pickedType; - } - get pickedId() { - return this._pickedId; - } - get isCapturingPickImage() { - return this._isCapturingPickImage; - } - capturePickImage() { - this._isCapturingPickImage = true; - } - get backgroundColor() { - return this._backgroundColor; - } - set backgroundColor(value2) { - if (!exactEquals(value2, this._backgroundColor)) { - this._backgroundColor = value2; - } - } - get ambientColor() { - return this._ambientColor; - } - set ambientColor(value2) { - if (!exactEquals$1(value2, this._ambientColor)) { - this._ambientColor = value2; - } - } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; - } - set currentAxes(value2) { - if (this._isAxes1Current) { - this._axes1 = value2; - } else { - this._axes2 = value2; - } - } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; - } - set previousAxes(value2) { - if (this._isAxes1Current) { - this._axes2 = value2; - } else { - this._axes1 = value2; - } - } - swapAxes() { - this._isAxes1Current = !this._isAxes1Current; - } - createCartesian2dAxesVisual(axes) { - return new AxesVisual(axes); - } - createCartesian3dAxesVisual(axes) { - return new AxesVisual(axes); - } - _createDebugAxesVisual(debugAxes) { - return null; - } - createLabelSetVisual(labelSet) { - return new LabelSetVisual$2(labelSet); - } - createControllerVisual(controller) { - return new ControllerVisual$1(controller); - } - createTransitionBuffer(ids) { - return new TransitionBuffer$2(this._core, ids); - } - createImageVisual(image2) { - return new ImageVisual$2(image2); - } - createFontVisual(font2) { - return new FontVisual$2(font2); - } - constructor(options2) { - this._options = options2; - this.fonts = {}; - } - get isWebXRSupported() { - return false; - } - initialize(core) { - this._core = core; - this._canvas = document.createElement("canvas"); - const contextmenu = this._options && this._options.contextmenu; - if (!contextmenu) { - this._canvas.addEventListener("contextmenu", (e) => { - e.preventDefault(); - }); - } - this._canvas.tabIndex = this._core.container.tabIndex; - this._canvas.style.display = "block"; - this._canvas.style.touchAction = "none"; - this._core.container.appendChild(this._canvas); - this._mvMatrices = [create$7(), create$7()]; - this.pickPMatrix = create$7(); - this.axesVisibility = AxesVisibility.current; - this._debugAxes = new DebugAxes(); - this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); - this.transitionTime = 1; - this.transitionBuffers = []; - this.areLabelsVisible = true; - this.labelSets = []; - this.controllers = []; - this.areImagesVisible = true; - this.images = []; - this._viewports = [new DOMRect(), new DOMRect()]; - this.isPickingEnabled = false; - this._pickedType = PickType.none; - this._pickedId = 0; - this._lassoMMatrix = create$7(); - this._lassoThickness = create$3(); - this._resizeMinimumDelay = -1; - this._previousResizeWidth = -1; - this._previousResizeHeight = -1; - } - remove() { - this._core.container.removeChild(this._canvas); - } - finalize() { - this._isInitialized = false; - } - setSize(elapsedTime) { - if (this._options && this._options.width && this._options.height) { - this._devicePixelRatio = 1; - this._resizeWidth = this._options.width; - this._resizeHeight = this._options.height; - } else { - this._devicePixelRatio = window.devicePixelRatio || 1; - this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; - this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; - } - if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { - this._previousResizeWidth = this._resizeWidth; - this._previousResizeHeight = this._resizeHeight; - this._isResizing = true; - this._resizeElapsedTime = elapsedTime; - } - if (this._isResizing) { - if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { - this._isResizing = false; - this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; - this._resize(this._resizeWidth, this._resizeHeight); - } else { - this._resizeElapsedTime += elapsedTime; - } - } - } - _resize(width2, height2) { - this._canvas.style.width = `${Math.floor(width2 / this._devicePixelRatio)}px`; - this._canvas.style.height = `${Math.floor(height2 / this._devicePixelRatio)}px`; - width2 = Math.floor(width2); - height2 = Math.floor(height2); - this._canvas.width = width2; - this._canvas.height = height2; - } - update(elapsedTime) { - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousPalette; - const current = transitionBuffer.currentPalette; - if (previous) { - previous.update(); - } - if (current) { - current.update(); - } - } - } - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousAtlas; - const current = transitionBuffer.currentAtlas; - if (previous) { - previous.update(); - } - if (current) { - current.update(); - } - } - } - if (this._core.config.isDebugVisible) { - if (this._debugAxesVisual) { - this._debugAxesVisual.mMatrix = this.mMatrix; - this._debugAxesVisual.vMatrices = this.vMatrices; - this._debugAxesVisual.pMatrices = this.pMatrices; - this._debugAxesVisual.viewports = this._viewports; - this._debugAxesVisual.viewportOffset = this._viewportOffset; - this._debugAxesVisual.viewportCount = this._viewportCount; - } - } - if (this.areLabelsVisible) { - for (let i = 0; i < this.labelSets.length; i++) { - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - this.labelSets[i].label.update(elapsedTime); - labelSetVisual.mMatrix = this.mMatrix; - labelSetVisual.vMatrices = this.vMatrices; - labelSetVisual.pMatrices = this.pMatrices; - labelSetVisual.isPickingEnabled = this.isPickingEnabled; - labelSetVisual.pickPMatrix = this.pickPMatrix; - labelSetVisual.pickVMatrix = this.pickVMatrix; - labelSetVisual.viewports = this._viewports; - labelSetVisual.viewportOffset = this._viewportOffset; - labelSetVisual.viewportCount = this._viewportCount; - labelSetVisual.update(elapsedTime); - } - } - } - if (this.areImagesVisible) { - for (let i = 0; i < this.images.length; i++) { - const imageVisual = this.images[i]; - if (imageVisual && imageVisual.isVisible) { - const image2 = this.images[i].image; - image2.update(elapsedTime); - imageVisual.mMatrix = this.mMatrix; - imageVisual.vMatrices = this.vMatrices; - imageVisual.pMatrices = this.pMatrices; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.pickPMatrix = this.pickPMatrix; - imageVisual.pickVMatrix = this.pickVMatrix; - imageVisual.viewports = this._viewports; - imageVisual.viewportOffset = this._viewportOffset; - imageVisual.viewportCount = this._viewportCount; - imageVisual.update(elapsedTime); - } - } - } - for (let i = 0; i < this.controllers.length; i++) { - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - const controller = this.controllers[i].controller; - controller.update(elapsedTime); - controllerVisual.vMatrices = this.vMatrices; - controllerVisual.inverseVMatrices = this.vMatrices; - controllerVisual.pMatrices = this.pMatrices; - controllerVisual.viewports = this._viewports; - controllerVisual.viewportOffset = this._viewportOffset; - controllerVisual.viewportCount = this._viewportCount; - controllerVisual.update(elapsedTime); - } - } - const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; - if (axesVisuals) { - for (let i = 0; i < axesVisuals.length; i++) { - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - const axes = axesVisual.axes; - axes.mMatrix = this.mMatrix; - axes.vMatrix = this.vMatrices[0]; - axes.update(elapsedTime); - axesVisual.vMatrices = this.vMatrices; - axesVisual.pMatrices = this.pMatrices; - axesVisual.isPickingEnabled = this.isPickingEnabled; - axesVisual.pickPMatrix = this.pickPMatrix; - axesVisual.pickVMatrix = this.pickVMatrix; - axesVisual.viewports = this._viewports; - axesVisual.viewportOffset = this._viewportOffset; - axesVisual.viewportCount = this._viewportCount; - axesVisual.update(elapsedTime); - } - } - } - for (const key2 in this.fonts) { - const fontVisual = this.fonts[key2]; - const font2 = fontVisual.font; - font2.update(); - fontVisual.update(); - } - } - getVertexPosition(position2, pickedId) { - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - const id2 = transitionBuffer.pickIdLookup[pickedId]; - if (id2 > -1) { - const index2 = transitionBuffer.currentBuffer.lookup[id2]; - const dataView = transitionBuffer.currentBuffer.dataView; - UnitVertex.getTranslation(dataView, index2, position2); - break; - } - } - } - render(elapsedTime, xrFrame) { - return __awaiter$3(this, void 0, void 0, function* () { - }); - } - prepare(xrFrame) { - } - initializeWebXR(session) { - return null; - } - } - let Quad$2 = class Quad { - get isInitialized() { - return this._isInitialized; - } - get vertexBuffer() { - return this._vertexBuffer; - } - get indexBuffer() { - return this._indexBuffer; - } - get indexCount() { - return this._indexCount; - } - initializeContext(gl) { - const _vec3 = fromValues$3(2, 2, 2); - const _mat4 = create$7(); - fromScaling(_mat4, _vec3); - const vertices = Quad$3.positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$3.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - }; - let Atlas$1 = class Atlas extends AtlasBase { - get texture() { - return this._texture; - } - get defaultTexture() { - return this._defaultTexture; - } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._imageData) { - this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - } else { - this._texture = null; - } - } - }; - let Palette$2 = class Palette extends PaletteBase { - get texture() { - return this._texture; - } - get defaultTexture() { - return this._defaultTexture; - } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._colors) { - const colors2 = new Uint8Array(this._colors); - for (let i = 0; i < colors2.length; i++) { - colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; - } - this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); - } else { - this._texture = null; - } - } - }; - let Buffer$2 = class Buffer extends BufferBase { - get vertexBuffer() { - return this._vertexBuffer; - } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } - }; - let TransitionBuffer$1 = class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids) { - super(core, ids, Buffer$2, Palette$2, Atlas$1); - } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; - } - }; - let Config$1 = class Config extends RendererConfig { - constructor() { - super(); - this.reset(); - } - reset() { - this.specularIntensity = 0.15; - this.specularPower = 150; - this.lightPosition = fromValues$3(-0.5, 0.5, 0); - this.ambient = 0.01; - const _quat1 = create$4(); - const _quat2 = create$4(); - let angle2 = AngleHelper.degreesToRadians(15); - setAxisAngle(_quat1, Constants$1.VECTOR3_UNITX, angle2); - multiply(_quat2, _quat1, _quat2); - angle2 = AngleHelper.degreesToRadians(-15); - setAxisAngle(_quat1, Constants$1.VECTOR3_UNITY, angle2); - multiply(_quat2, _quat2, _quat1); - this.directionToLight = create$6(); - transformQuat(this.directionToLight, Constants$1.VECTOR3_UNITZ, _quat2); - this.halfAngle = create$6(); - add$4(this.halfAngle, Constants$1.VECTOR3_UNITZ, this.directionToLight); - normalize$5(this.halfAngle, this.halfAngle); - this.isFxaaEnabled = false; - } - }; - let Resources$1 = class Resources { - bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } - } - initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); - this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); - this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); - this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } - }; - Resources$1.glsl = { - "anaglyph.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n', - "color.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n', - "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", - "lasso.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', - "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "model.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n', - "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", - "pickgrid.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n', - "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n', - "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", - "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", - "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", - "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n', - "unitblock.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', - "unitcylinder.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', - "unitcylinder.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', - "unithexprism.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.ytN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', - "unithexprism.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n', - "unitsdf.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n', - "unitsdf.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', - "unitsphere.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', - "unitsphere.vertex.fx": '#version 100\n#include "common.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', - "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", - "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" - }; - let ShaderBase$1 = class ShaderBase { - get isInitialized() { - return this._isInitialized; - } - get vertexBuffer() { - return this._vertexBuffer; - } - set vertexBuffer(value2) { - if (this._vertexBuffer != value2) { - this._vertexBuffer = value2; - this._haveBuffersChanged = true; - } - } - get indexBuffer() { - return this._indexBuffer; - } - set indexBuffer(value2) { - if (this._indexBuffer != value2) { - this._indexBuffer = value2; - this._haveBuffersChanged = true; - } - } - constructor(core, main) { - this._core = core; - this._main = main; - } - initializeContext(gl) { - this._gl = gl; - } - _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); - } - return program; - } - _compileShader(source2, type2) { - const shader = this._gl.createShader(type2); - this._gl.shaderSource(shader, source2); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); - } - return shader; - } - _removeDirective(shaderSource, directive) { - const remove2 = `#define ${directive}`; - const index2 = shaderSource.indexOf(remove2); - shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); - return shaderSource; - } - prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) { - this._main.shaderResources.currentShader.disableProgram(); - } - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) { - this.updateBuffers(); - } - if (this._haveTexturesChanged) { - this.updateTextures(); - } - } - } - apply() { - } - applyModel() { - } - applyView() { - } - enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; - } - updateBuffers() { - this._haveBuffersChanged = false; - } - updateTextures() { - this._haveTexturesChanged = false; - } - disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; - } - _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); - } - _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource) => { - this._includesFromUrl(vsSource, 0, (vsIncSource) => { - this._sourceFromUrl(fsName, (fsSource) => { - this._includesFromUrl(fsSource, 0, (fsIncSource) => { - callback(vsIncSource, fsIncSource); - }); - }); - }); - }); - } - _sourceFromUrl(url, callback) { - const request2 = new XMLHttpRequest(); - request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); - request2.onreadystatechange = () => { - if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { - callback(request2.responseText); - } - }; - request2.send(); - } - _includesFromFile(source2) { - let index2 = 0; - do { - index2 = source2.indexOf("#include", index2); - if (index2 != -1) { - const start = source2.indexOf('"', index2); - const end = source2.indexOf('"', start + 1); - const name = source2.substring(start + 1, end); - const inc = Resources$1.glsl[name]; - source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); - } - } while (index2 != -1); - return source2; - } - _includesFromUrl(source2, index2, callback) { - index2 = source2.indexOf("#include", index2); - if (index2 != -1) { - const start = source2.indexOf('"', index2); - const end = source2.indexOf('"', start + 1); - const name = source2.substring(start + 1, end); - this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { - source2 = source2.substring(0, index2) + include + source2.substring(end + 1); - this._includesFromUrl(source2, index2, callback); - }); - } else { - callback(source2); - } - } - }; - let Color$1 = class Color extends ShaderBase$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._colorAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - let Texture$1 = class Texture extends ShaderBase$1 { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - }; - let Lasso$3 = class Lasso extends ShaderBase$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; - } - apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); - } - applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - class Model extends ShaderBase$1 { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - } - applyView() { - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - let SdfText$1 = class SdfText extends ShaderBase$1 { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - }; - let PickGrid$1 = class PickGrid extends ShaderBase$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - let UnitShader$1 = class UnitShader extends ShaderBase$1 { - get paletteTexture() { - return this._paletteTexture; - } - set paletteTexture(value2) { - if (this._paletteTexture != value2) { - this._paletteTexture = value2; - this._haveTexturesChanged = true; - } - } - get previousPaletteTexture() { - return this._previousPaletteTexture; - } - set previousPaletteTexture(value2) { - if (this._previousPaletteTexture != value2) { - this._previousPaletteTexture = value2; - this._haveTexturesChanged = true; - } - } - get sdfTexture() { - return this._sdfTexture; - } - set sdfTexture(value2) { - if (this._sdfTexture != value2) { - this._sdfTexture = value2; - this._haveTexturesChanged = true; - } - } - get previousSdfTexture() { - return this._previousSdfTexture; - } - set previousSdfTexture(value2) { - if (this._previousSdfTexture != value2) { - this._previousSdfTexture = value2; - this._haveTexturesChanged = true; - } - } - set instanceBuffer(value2) { - if (this._instanceBuffer != value2) { - this._instanceBuffer = value2; - this._haveBuffersChanged = true; - } - } - set previousInstanceBuffer(value2) { - if (this._previousInstanceBuffer != value2) { - this._previousInstanceBuffer = value2; - this._haveBuffersChanged = true; - } - } - initializeData() { - this._areBuffersInitialized = false; - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); - this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); - this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); - this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); - const vertices = Cube.POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Cube.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); - } - _updateCurrentBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); - } - _updatePreviousBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - if (this._previousInstanceBuffer != this._instanceBuffer) { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - } - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform1f(this._ambientUniform, this.ambient); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._activeColorUniform, this.activeColor); - this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0 : 1); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - } - updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); - } - }; - let UnitBlock$1 = class UnitBlock extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } - }; - let UnitSphere$1 = class UnitSphere extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.EXT_frag_depth == null) { - fsSource = this._removeDirective(fsSource, "FragDepth"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - }; - let UnitCylinder$1 = class UnitCylinder extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.EXT_frag_depth == null) { - fsSource = this._removeDirective(fsSource, "FragDepth"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } - }; - class UnitHexPrism extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.EXT_frag_depth == null) { - fsSource = this._removeDirective(fsSource, "FragDepth"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } - } - let UnitSdf$1 = class UnitSdf extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); - this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); - } - }; - class Anaglyph extends ShaderBase$1 { - get texture2D1() { - return this._texture2D1; - } - set texture2D1(value2) { - if (this._texture2D1 != value2) { - this._texture2D1 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D2() { - return this._texture2D2; - } - set texture2D2(value2) { - if (this._texture2D2 != value2) { - this._texture2D2 = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - } - } - class DebugAxesVisual { - get isInitialized() { - return this._isInitialized && this._main.colorShader.isInitialized; - } - constructor(core, main, debugAxes) { - this._main = main; - this._debugAxes = debugAxes; - this.isVisible = true; - } - initializeContext(gl) { - if (!this._debugAxes.isInitialized) { - this._debugAxes.initialize(); - } - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const colorShader = this._main.colorShader; - const shaderResources = this._main.shaderResources; - colorShader.vertexBuffer = this._vertexBuffer; - colorShader.indexBuffer = this._indexBuffer; - colorShader.prepare(); - colorShader.mMatrix = this.mMatrix; - colorShader.apply(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - colorShader.vMatrix = this.vMatrices[viewport]; - colorShader.pMatrix = this.pMatrices[viewport]; - colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - let AxesVisualBase$1 = class AxesVisualBase { - get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; - } - constructor(core) { - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; - } - update(elapsedTime) { - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() { - } - _renderText() { - } - }; - let Cartesian2dVisual$1 = class Cartesian2dVisual extends AxesVisualBase$1 { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes) { - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = () => { - this._hasChanged = true; - }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 255; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 2; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = Constants$1.VECTOR3_UNITZ; - gridShader.apply(); - for (let axisId = 0; axisId < 2; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width3 = gridTicksScale[0]; - const height3 = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width3, height3); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width2 = size[axisId2]; - const height2 = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for (let face = 0; face < 2; face++) { - const faceId = face; - if (axes.getIsForwardFace(faceId)) { - this._renderGridFace(faceId, width2, height2); - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width2, height2) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width2, height2) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - }; - let Cartesian3dVisual$1 = class Cartesian3dVisual extends AxesVisualBase$1 { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes) { - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = () => { - this._hasChanged = true; - }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 255; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 3; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = Constants$1.VECTOR3_UNITZ; - gridShader.apply(); - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width2 = gridTicksScale[0]; - const height2 = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width2, height2); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width2 = size[axisId2]; - const height2 = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { - this._renderGridFace(faceId, width2, height2); - } - } - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width2, height2) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width2, height2) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - }; - class ControllerVisual { - get isInitialized() { - return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; - } - get controller() { - return this._controller; - } - constructor(core, main, controller) { - this._core = core; - this._main = main; - this._mMatrix = create$7(); - this._vec3 = create$6(); - this._controller = controller; - this._modelShader = main.modelShader; - this._colorShader = main.colorShader; - this.mMatrix = create$7(); - this.rayMMatrix = create$7(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._controller.isInitialized) { - this._controller.initialize(); - } - this._initialize(gl); - } - _initialize(gl) { - this._gl = gl; - this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); - this._modelVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); - this._modelIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); - this._rayVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); - this._rayIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._modelShader.vertexBuffer = this._modelVertexBuffer; - this._modelShader.indexBuffer = this._modelIndexBuffer; - this._modelShader.texture2D = this.modelTexture; - this._modelShader.prepare(); - multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); - this._modelShader.mMatrix = this._mMatrix; - this._modelShader.specularPower = 10; - this._modelShader.specularIntensity = 0.01; - this._modelShader.apply(); - this._modelShader.applyModel(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._modelShader.directionToLight = Constants$1.VECTOR3_UNITZ; - this._modelShader.halfAngle = Constants$1.VECTOR3_UNITZ; - this._modelShader.vMatrix = this.vMatrices[viewport]; - this._modelShader.pMatrix = this.pMatrices[viewport]; - this._modelShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isRayVisible) { - this._colorShader.vertexBuffer = this._rayVertexBuffer; - this._colorShader.indexBuffer = this._rayIndexBuffer; - this._colorShader.prepare(); - multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); - this._colorShader.mMatrix = this._mMatrix; - this._colorShader.apply(); - this._colorShader.applyModel(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._colorShader.vMatrix = this.vMatrices[viewport]; - this._colorShader.pMatrix = this.pMatrices[viewport]; - this._colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - } - let ImageVisual$1 = class ImageVisual { - get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; - } - get image() { - return this._image; - } - constructor(core, main, image2) { - this._core = core; - this._main = main; - this._image = image2; - this._image.hasChangedCallback = () => { - this._hasChanged = true; - }; - this.mMatrix = create$7(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._image.isInitialized) { - this._image.initialize(); - } - this._gl = gl; - if (this._image.imageData) { - this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); - } - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - const shaderResources = this._main.shaderResources; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.isPickShader = false; - textureShader.apply(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - textureShader.isPickShader = true; - textureShader.vMatrix = this.pickVMatrix; - textureShader.pMatrix = this.pickPMatrix; - textureShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - }; - let LabelVisualBase$1 = class LabelVisualBase { - get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label2) { - this._core = core; - this._main = main; - this._label = label2; - this._label.hasChangedCallback = () => { - this._hasChanged = true; - }; - this._mMatrix = create$7(); - this.mMatrix = create$7(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._label.isInitialized) { - this._label.initialize(); - } - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - this._main.shaderResources.currentProgram = null; - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 255; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - } - } - } - }; - let LabelVisual$1 = class LabelVisual extends LabelVisualBase$1 { - get label() { - return this._label; - } - set text(value2) { - this._label.text = value2; - } - get text() { - return this._label.text; - } - constructor(core, main, label2) { - super(core, main, label2); - } - }; - let LabelSetVisual$1 = class LabelSetVisual extends LabelVisualBase$1 { - get label() { - return this._label; - } - constructor(core, main, label2) { - super(core, main, label2); - } - }; - let FontVisual$1 = class FontVisual { - get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; - } - constructor(core, font2) { - this._core = core; - this._font = font2; - font2.hasChangedCallback = () => { - this._hasChanged = true; - }; - } - initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) { - this._hasChanged = true; - } - } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); - } - } - }; - let Lasso$2 = class Lasso { - get isInitialized() { - return this._isInitialized; - } - get vertexBuffer() { - return this._vertexBuffer; - } - get indexBuffer() { - return this._indexBuffer; - } - get indexCount() { - return this._indexCount; - } - initializeContext(gl) { - const vertices = Quad$3.textured(Constants$1.MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$3.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - }; - var __awaiter$2 = function(thisArg, _arguments, P, generator) { - function adopt(value2) { - return value2 instanceof P ? value2 : new P(function(resolve2) { - resolve2(value2); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value2) { - try { - step(generator.next(value2)); - } catch (e) { - reject(e); - } - } - function rejected(value2) { - try { - step(generator["throw"](value2)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - let Main$1 = class Main extends RendererBase { - get shaderResources() { - return this._shaderResources; - } - get colorShader() { - return this._colorShader; - } - get textureShader() { - return this._textureShader; - } - get lassoShader() { - return this._lassoShader; - } - get modelShader() { - return this._modelShader; - } - get sdfTextShader() { - return this._sdfTextShader; - } - get gridShader() { - return this._gridShader; - } - get blockShader() { - return this._blockShader; - } - get sphereShader() { - return this._sphereShader; - } - get cyclinderShader() { - return this._cylinderShader; - } - get hexPrismShader() { - return this._hexPrismShader; - } - get sdfShader() { - return this._sdfShader; - } - get anaglyphShader() { - return this._anaglyphShader; - } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; - } - set currentAxes(value2) { - if (this._isAxes1Current) { - this._axes1 = value2; - } else { - this._axes2 = value2; - } - } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; - } - set previousAxes(value2) { - if (this._isAxes1Current) { - this._axes2 = value2; - } else { - this._axes1 = value2; - } - } - get config() { - return this._config; - } - constructor(options2) { - super(options2); - this._config = new Config$1(); - this._quad = new Quad$2(); - this._lasso = new Lasso$2(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = create$5(); - this._mat3 = create$8(); - this._directionToCamera = create$6(); - this._directionToLight = create$6(); - this._halfAngle = create$6(); - this._cameraPosition = create$6(); - this._modelPosition = create$6(); - this.depthEnabled = true; - } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; - } - get isWebXRSupported() { - return true; - } - initialize(core) { - super.initialize(core); - this._shaderResources = new Resources$1(); - this._colorShader = new Color$1(this._core, this); - this._textureShader = new Texture$1(this._core, this); - this._lassoShader = new Lasso$3(this._core, this); - this._modelShader = new Model(this._core, this); - this._sdfTextShader = new SdfText$1(this._core, this); - this._gridShader = new PickGrid$1(this._core, this); - this._anaglyphShader = new Anaglyph(this._core, this); - this._blockShader = new UnitBlock$1(this._core, this); - this._sphereShader = new UnitSphere$1(this._core, this); - this._cylinderShader = new UnitCylinder$1(this._core, this); - this._hexPrismShader = new UnitHexPrism(this._core, this); - this._sdfShader = new UnitSdf$1(this._core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event2) => { - this._core.log.write(LogLevel.warn, "WebGL context lost"); - this._isInitialized = false; - event2.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", () => { - this._initializeContext(this._createContext(this._canvas)); - this._isInitialized = true; - this._core.log.write(LogLevel.info, "WebGL context restored"); - }, false); - this._isInitialized = true; - } - _initializeContext(gl) { - this._gl = gl; - for (const key2 in this.fonts) { - const fontVisual = this.fonts[key2]; - fontVisual.initializeContext(gl); - } - this._shaderResources.initializeContext(this._gl); - this._colorShader.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._modelShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._anaglyphShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._hexPrismShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._debugAxesVisual.initializeContext(this._gl); - this._framebuffers = [null, null]; - const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - this._anaglyphTextures = [null, null]; - this.anaglyphFramebuffers = [null, null]; - for (let i = 0; i < this.transitionBuffers.length; i++) { - this.transitionBuffers[i].initializeContext(this._gl); - } - if (this._axes1) { - for (let i = 0; i < this._axes1.length; i++) { - this._axes1[i].initializeContext(this._gl); - } - } - if (this._axes2) { - for (let i = 0; i < this._axes2.length; i++) { - this._axes2[i].initializeContext(this._gl); - } - } - for (let i = 0; i < this.labelSets.length; i++) { - this.labelSets[i].initializeContext(this._gl); - } - for (let i = 0; i < this.images.length; i++) { - this.images[i].initializeContext(this._gl); - } - for (let i = 0; i < this.controllers.length; i++) { - this.controllers[i].initializeContext(this._gl); - } - } - _resize(width2, height2) { - super._resize(width2, height2); - for (let i = 0; i < 2; i++) { - const texture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width2, height2); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._anaglyphTextures[i] = texture; - this.anaglyphFramebuffers[i] = framebuffer; - } - this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); - } - _createContext(canvas) { - const antialias = this._options ? this._options.antialias === void 0 ? true : this._options.antialias : true; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; - return canvas.getContext("webgl", { - stencil: true, - alpha: true, - antialias, - preserveDrawingBuffer - }); - } - initializeWebXR(session) { - const promise = new Promise((resolve2, reject) => { - this._gl.makeXRCompatible().then(() => { - session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, this._gl), - depthNear: this._core.config.nearPlane, - depthFar: this._core.config.farPlane - }); - session.requestReferenceSpace("local").then((refSpace) => { - this._webXRReferenceSpace = refSpace; - resolve2(); - }); - }); - }); - return promise; - } - prepare(xrFrame) { - if (xrFrame) { - const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); - if (pose) { - const glLayer = xrFrame.session.renderState.baseLayer; - for (let i = 0; i < pose.views.length; i++) { - const view = pose.views[i]; - this.vMatrices[i] = view.transform.inverse.matrix; - this.inverseVMatrices[i] = view.transform.matrix; - multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); - this.mvMatrices[i] = this._mvMatrices[i]; - this.pMatrices[i] = view.projectionMatrix; - const viewport = glLayer.getViewport(view); - this._viewports[i].x = viewport.x; - this._viewports[i].y = viewport.y; - this._viewports[i].width = viewport.width; - this._viewports[i].height = viewport.height; - this._framebuffers[i] = glLayer.framebuffer; - } - } - this._viewportOffset = 0; - this._viewportCount = 2; - } else { - let viewport; - switch (this._core.config.stereoMode) { - case StereoMode.none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case StereoMode.left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case StereoMode.right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - this._framebuffers[1] = null; - break; - case StereoMode.anaglyph: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = this.anaglyphFramebuffers[0]; - this._framebuffers[1] = this.anaglyphFramebuffers[1]; - break; - case StereoMode.split: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = this._canvas.width / 2; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = null; - this._framebuffers[1] = null; - break; - } - } - } - createTransitionBuffer(ids) { - const buffer = new TransitionBuffer$1(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; - } - createControllerVisual(controller) { - const visual = new ControllerVisual(this._core, this, controller); - visual.initializeContext(this._gl); - return visual; - } - createCartesian2dAxesVisual(axes) { - const visual = new Cartesian2dVisual$1(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - createCartesian3dAxesVisual(axes) { - const visual = new Cartesian3dVisual$1(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - _createDebugAxesVisual(debugAxes) { - return new DebugAxesVisual(this._core, this, debugAxes); - } - _createLabelVisual(label2) { - return new LabelVisual$1(this._core, this, label2); - } - createLabelSetVisual(labelSet) { - const visual = new LabelSetVisual$1(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; - } - createImageVisual(image2) { - const visual = new ImageVisual$1(this._core, this, image2); - visual.initializeContext(this._gl); - return visual; - } - createFontVisual(font2) { - const visual = new FontVisual$1(this._core, font2); - visual.initializeContext(this._gl); - return visual; - } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); - } - render(elapsedTime, xrFrame) { - return __awaiter$2(this, void 0, void 0, function* () { - if (this.depthEnabled) { - this._gl.enable(this._gl.DEPTH_TEST); - } else { - this._gl.disable(this._gl.DEPTH_TEST); - } - this._gl.enable(this._gl.CULL_FACE); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); - if (xrFrame) { - const glLayer = xrFrame.session.renderState.baseLayer; - this._shaderResources.bindFramebuffer(glLayer.framebuffer); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else if (this._core.config.stereoMode == StereoMode.anaglyph) { - for (let i = 0; i < 2; i++) { - this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else { - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - if (this._core.config.isDebugVisible) { - this._debugAxesVisual.framebuffers = this._framebuffers; - this._debugAxesVisual.render(elapsedTime, xrFrame); - } - const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; - if (axesVisuals) { - for (let i = 0; i < axesVisuals.length; i++) { - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.framebuffers = this._framebuffers; - axesVisual.render(elapsedTime, xrFrame); - } - } - } - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - this._renderTransitionBuffer(xrFrame, transitionBuffer); - } - } - if (this.areLabelsVisible) { - for (let i = 0; i < this.labelSets.length; i++) { - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.framebuffers = this._framebuffers; - labelSetVisual.render(elapsedTime, xrFrame); - } - } - } - if (this.areImagesVisible) { - for (let i = 0; i < this.images.length; i++) { - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.framebuffers = this._framebuffers; - imageVisual.pickFramebuffer = this._pickFrameBuffer; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.render(elapsedTime, xrFrame); - } - } - } - for (let i = 0; i < this.controllers.length; i++) { - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - controllerVisual.isRayVisible = this.isPickingEnabled; - controllerVisual.framebuffers = this._framebuffers; - controllerVisual.render(elapsedTime, xrFrame); - } - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = PickHelper.decodeType(this._pickedPixels); - set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); - this._pickedId = PickHelper.decodeNumber(this._pickedPixels); - if (this._isCapturingPickImage && this.capturePickImageCallback) { - this._isCapturingPickImage = false; - const data2 = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); - this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data2); - for (let i = 0; i < data2.length / 4; i++) { - if (data2[i * 4 + 3] == PickType.data) { - data2[i * 4 + 3] = 255; - } else { - data2[i * 4] = 0; - data2[i * 4 + 1] = 0; - data2[i * 4 + 2] = 0; - data2[i * 4 + 3] = 0; - } - } - const length2 = this._core.config.pickWidth * this._core.config.pickHeight * 4; - const row = this._core.config.pickWidth * 4; - const end = (this._core.config.pickHeight - 1) * row; - const flipped = new Uint8ClampedArray(length2); - for (let i = 0; i < length2; i += row) { - flipped.set(data2.subarray(i, i + row), end - i); - } - this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); - } - } else { - set$7(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for (let i = 0; i < this._viewportCount; i++) { - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { - this._shaderResources.bindFramebuffer(null); - this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); - this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; - this._anaglyphShader.indexBuffer = this._quad.indexBuffer; - this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; - this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; - this._anaglyphShader.prepare(); - this._anaglyphShader.viewport = this._viewports[0]; - this._anaglyphShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - }); - } - _renderTransitionBuffer(xrFrame, transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; - const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = 0; - this._blockShader.rangeMax = transitionBuffer.length - 1; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.selectedColor = this._core.config.selectionColor; - this._blockShader.hoverColor = this._core.config.hoverColor; - this._blockShader.activeColor = this._core.config.activeColor; - this._blockShader.highlightMode = this._core.config.highlightMode; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.ambient = this._config.ambient; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$5(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$5(this._directionToCamera, this._directionToCamera); - add$4(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$5(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._blockShader.directionToLight = this._directionToLight; - this._blockShader.halfAngle = this._halfAngle; - } else { - this._blockShader.directionToLight = this._config.directionToLight; - this._blockShader.halfAngle = this._config.halfAngle; - } - this._blockShader.vMatrix = vMatrix; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = 0; - this._sphereShader.rangeMax = transitionBuffer.length - 1; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.selectedColor = this._core.config.selectionColor; - this._sphereShader.hoverColor = this._core.config.hoverColor; - this._sphereShader.activeColor = this._core.config.activeColor; - this._sphereShader.highlightMode = this._core.config.highlightMode; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.ambient = this._config.ambient; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$5(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$5(this._directionToCamera, this._directionToCamera); - add$4(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$5(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sphereShader.directionToLight = this._directionToLight; - this._sphereShader.halfAngle = this._halfAngle; - } else { - this._sphereShader.directionToLight = this._config.directionToLight; - this._sphereShader.halfAngle = this._config.halfAngle; - } - this._sphereShader.vMatrix = vMatrix; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = 0; - this._cylinderShader.rangeMax = transitionBuffer.length - 1; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.selectedColor = this._core.config.selectionColor; - this._cylinderShader.hoverColor = this._core.config.hoverColor; - this._cylinderShader.activeColor = this._core.config.activeColor; - this._cylinderShader.highlightMode = this._core.config.highlightMode; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.ambient = this._config.ambient; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$5(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$5(this._directionToCamera, this._directionToCamera); - add$4(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$5(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._cylinderShader.directionToLight = this._directionToLight; - this._cylinderShader.halfAngle = this._halfAngle; - } else { - this._cylinderShader.directionToLight = this._config.directionToLight; - this._cylinderShader.halfAngle = this._config.halfAngle; - } - this._cylinderShader.vMatrix = vMatrix; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { - this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; - this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._hexPrismShader.prepare(); - this._hexPrismShader.mMatrix = this.mMatrix; - this._hexPrismShader.time = this.transitionTime; - this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._hexPrismShader.rangeMin = 0; - this._hexPrismShader.rangeMax = transitionBuffer.length - 1; - this._hexPrismShader.hover = hoverId; - this._hexPrismShader.active = activeId; - this._hexPrismShader.selectedColor = this._core.config.selectionColor; - this._hexPrismShader.hoverColor = this._core.config.hoverColor; - this._hexPrismShader.activeColor = this._core.config.activeColor; - this._hexPrismShader.highlightMode = this._core.config.highlightMode; - this._hexPrismShader.specularPower = this._config.specularPower; - this._hexPrismShader.specularIntensity = this._config.specularIntensity; - this._hexPrismShader.ambient = this._config.ambient; - this._hexPrismShader.apply(); - this._hexPrismShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$5(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$5(this._directionToCamera, this._directionToCamera); - add$4(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$5(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._hexPrismShader.directionToLight = this._directionToLight; - this._hexPrismShader.halfAngle = this._halfAngle; - } else { - this._hexPrismShader.directionToLight = this._config.directionToLight; - this._hexPrismShader.halfAngle = this._config.halfAngle; - } - this._hexPrismShader.vMatrix = vMatrix; - this._hexPrismShader.pMatrix = this.pMatrices[viewport]; - this._hexPrismShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._hexPrismShader.isPickShader = true; - this._hexPrismShader.pMatrix = this.pickPMatrix; - this._hexPrismShader.vMatrix = this.pickVMatrix; - this._hexPrismShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = 0; - this._sdfShader.rangeMax = transitionBuffer.length - 1; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.selectedColor = this._core.config.selectionColor; - this._sdfShader.hoverColor = this._core.config.hoverColor; - this._sdfShader.activeColor = this._core.config.activeColor; - this._sdfShader.highlightMode = this._core.config.highlightMode; - this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 255; - this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.ambient = this._config.ambient; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$5(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$5(this._directionToCamera, this._directionToCamera); - add$4(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$5(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sdfShader.directionToLight = this._directionToLight; - this._sdfShader.halfAngle = this._halfAngle; - } else { - this._sdfShader.directionToLight = this._config.directionToLight; - this._sdfShader.halfAngle = this._config.halfAngle; - } - this._sdfShader.vMatrix = vMatrix; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - } - }; - let Quad$1 = class Quad { - get isInitialized() { - return this._isInitialized; - } - get vertexBuffer() { - return this._vertexBuffer; - } - get indexBuffer() { - return this._indexBuffer; - } - get indexCount() { - return this._indexCount; - } - initializeContext(gl) { - const _vec3 = fromValues$3(2, 2, 2); - const _mat4 = create$7(); - fromScaling(_mat4, _vec3); - const vertices = Quad$3.positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$3.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - }; - class Atlas extends AtlasBase { - get texture() { - return this._texture; - } - get defaultTexture() { - return this._defaultTexture; - } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._imageData) { - this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - } else { - this._texture = null; - } - } - } - let Palette$1 = class Palette extends PaletteBase { - get texture() { - return this._texture; - } - get defaultTexture() { - return this._defaultTexture; - } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._colors) { - const colors2 = new Uint8Array(this._colors); - for (let i = 0; i < colors2.length; i++) { - colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; - } - this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); - } else { - this._texture = null; - } - } - }; - let Buffer$1 = class Buffer extends BufferBase { - get vertexBuffer() { - return this._vertexBuffer; - } - constructor(core, ids) { - super(core, ids); - } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } - }; - class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids) { - super(core, ids, Buffer$1, Palette$1, Atlas); - } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; - } - } - class Config extends RendererConfig { - get keyLightAltitude() { - return this._keyLightAltitude; - } - set keyLightAltitude(value2) { - this._keyLightAltitude = value2; - this._updateLights(); - } - get keyLightAzimuth() { - return this._keyLightAzimuth; - } - set keyLightAzimuth(value2) { - this._keyLightAzimuth = value2; - this._updateLights(); - } - get keyLightDistance() { - return this._keyLightDistance; - } - set keyLightDistance(value2) { - this._keyLightDistance = value2; - this._updateLights(); - } - get fillLight1Altitude() { - return this._fillLight1Altitude; - } - set fillLight1Altitude(value2) { - this._fillLight1Altitude = value2; - this._updateLights(); - } - get fillLight1Azimuth() { - return this._fillLight1Azimuth; - } - set fillLight1Azimuth(value2) { - this._fillLight1Azimuth = value2; - this._updateLights(); - } - get fillLight2Altitude() { - return this._fillLight2Altitude; - } - set fillLight2Altitude(value2) { - this._fillLight2Altitude = value2; - this._updateLights(); - } - get fillLight2Azimuth() { - return this._fillLight2Azimuth; - } - set fillLight2Azimuth(value2) { - this._fillLight2Azimuth = value2; - this._updateLights(); - } - constructor() { - super(); - this._rotation = create$4(); - this.keyLightPosition = create$6(); - this.fillLight1Position = create$6(); - this.fillLight2Position = create$6(); - this.reset(); - } - _updateLights() { - this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); - this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); - this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); - } - _updateLight(altitude, azimuth, distance2, position2) { - rotateY(this._rotation, Constants$1.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); - rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); - transformQuat(position2, Constants$1.VECTOR3_UNITZ, this._rotation); - scale$5(position2, position2, distance2); - } - reset() { - this.isSsaoEnabled = true; - this.ssaoWidth = 1024; - this.ssaoHeight = 1024; - this.ssaoBlurEnabled = true; - this.ssaoKernelSize = 8; - this.ssaoNoiseSize = 4; - this.ssaoRadius = 0.02; - this.ssaoPower = 1; - this.isShadowEnabled = true; - this.shadowWidth = 1024; - this.shadowHeight = 1024; - this.isDofEnabled = false; - this.dofAutoFocus = true; - this.dofFocusDistance = 0.5; - this.dofFocusRange = 0.5; - this.dofMaxBackgroundBlur = 0.75; - this.isBloomEnabled = false; - this.bloomIntensity = 2; - this.specularIntensity = 0.15; - this.specularPower = 150; - this.ambientIntensity = 0.1; - this.materialIntensity = 0.5; - this.keyLightIntensity = 1.5; - this.fillLight1Intensity = 0.25; - this.fillLight2Intensity = 0.25; - this._keyLightAltitude = 30; - this._keyLightAzimuth = -45; - this._keyLightDistance = 1; - this._fillLight1Altitude = 30; - this._fillLight1Azimuth = 45; - this._fillLight2Altitude = 30; - this._fillLight2Azimuth = -135; - this._updateLights(); - this.isFxaaEnabled = false; - } - } - class Resources { - bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } - } - initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.OES_texture_float = gl.getExtension("OES_texture_float"); - this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } - } - Resources.glsl = { - "background.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n', - "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", - "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", - "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", - "deferred.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n', - "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", - "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", - "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", - "fxaa.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n', - "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", - "lasso.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', - "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "pickgrid.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n', - "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", - "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", - "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", - "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", - "texture.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n', - "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', - "unitblock.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', - "unitcylinder.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', - "unitcylinder.vertex.fx": '#version 300 es\n#include "common.include.fx"\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', - "unitsdf.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n', - "unitsdf.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', - "unitsphere.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', - "unitsphere.vertex.fx": '#version 300 es\n#include "common.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', - "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", - "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", - "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" - }; - class ShaderBase { - get isInitialized() { - return this._isInitialized; - } - get vertexBuffer() { - return this._vertexBuffer; - } - set vertexBuffer(value2) { - if (this._vertexBuffer != value2) { - this._vertexBuffer = value2; - this._haveBuffersChanged = true; - } - } - get indexBuffer() { - return this._indexBuffer; - } - set indexBuffer(value2) { - if (this._indexBuffer != value2) { - this._indexBuffer = value2; - this._haveBuffersChanged = true; - } - } - constructor(core, main) { - this._core = core; - this._main = main; - } - initializeContext(gl) { - this._gl = gl; - } - _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); - } - return program; - } - _compileShader(source2, type2) { - const shader = this._gl.createShader(type2); - this._gl.shaderSource(shader, source2); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); - } - return shader; - } - _removeDirective(shaderSource, directive) { - const remove2 = `#define ${directive}`; - const index2 = shaderSource.indexOf(remove2); - shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); - return shaderSource; - } - prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) { - this._main.shaderResources.currentShader.disableProgram(); - } - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) { - this.updateBuffers(); - } - if (this._haveTexturesChanged) { - this.updateTextures(); - } - } - } - apply() { - } - applyModel() { - } - applyView() { - } - enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; - } - updateBuffers() { - this._haveBuffersChanged = false; - } - updateTextures() { - this._haveTexturesChanged = false; - } - disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; - } - _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); - } - _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource) => { - this._includesFromUrl(vsSource, 0, (vsIncSource) => { - this._sourceFromUrl(fsName, (fsSource) => { - this._includesFromUrl(fsSource, 0, (fsIncSource) => { - callback(vsIncSource, fsIncSource); - }); - }); - }); - }); - } - _sourceFromUrl(url, callback) { - const request2 = new XMLHttpRequest(); - request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); - request2.onreadystatechange = () => { - if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { - callback(request2.responseText); - } - }; - request2.send(); - } - _includesFromFile(source2) { - let index2 = 0; - do { - index2 = source2.indexOf("#include", index2); - if (index2 != -1) { - const start = source2.indexOf('"', index2); - const end = source2.indexOf('"', start + 1); - const name = source2.substring(start + 1, end); - const inc = Resources.glsl[name]; - source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); - } - } while (index2 != -1); - return source2; - } - _includesFromUrl(source2, index2, callback) { - index2 = source2.indexOf("#include", index2); - if (index2 != -1) { - const start = source2.indexOf('"', index2); - const end = source2.indexOf('"', start + 1); - const name = source2.substring(start + 1, end); - this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { - source2 = source2.substring(0, index2) + include + source2.substring(end + 1); - this._includesFromUrl(source2, index2, callback); - }); - } else { - callback(source2); - } - } - } - class Texture extends ShaderBase { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - let Lasso$1 = class Lasso extends ShaderBase { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; - } - apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); - } - applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - class SdfText extends ShaderBase { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - class PickGrid extends ShaderBase { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - } - class UnitShader extends ShaderBase { - get paletteTexture() { - return this._paletteTexture; - } - set paletteTexture(value2) { - if (this._paletteTexture != value2) { - this._paletteTexture = value2; - this._haveTexturesChanged = true; - } - } - get previousPaletteTexture() { - return this._previousPaletteTexture; - } - set previousPaletteTexture(value2) { - if (this._previousPaletteTexture != value2) { - this._previousPaletteTexture = value2; - this._haveTexturesChanged = true; - } - } - get sdfTexture() { - return this._sdfTexture; - } - set sdfTexture(value2) { - if (this._sdfTexture != value2) { - this._sdfTexture = value2; - this._haveTexturesChanged = true; - } - } - get previousSdfTexture() { - return this._previousSdfTexture; - } - set previousSdfTexture(value2) { - if (this._previousSdfTexture != value2) { - this._previousSdfTexture = value2; - this._haveTexturesChanged = true; - } - } - set instanceBuffer(value2) { - if (this._instanceBuffer != value2) { - this._instanceBuffer = value2; - this._haveBuffersChanged = true; - } - } - set previousInstanceBuffer(value2) { - if (this._previousInstanceBuffer != value2) { - this._previousInstanceBuffer = value2; - this._haveBuffersChanged = true; - } - } - initializeData() { - this._areBuffersInitialized = false; - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - const vertices = Cube.POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Cube.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); - } - _updateCurrentBuffer() { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); - } - _updatePreviousBuffer() { - if (this._previousInstanceBuffer != this._instanceBuffer) { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - } - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); - } - updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._translationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); - this._gl.vertexAttribDivisor(this._scaleAttribute, 0); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); - this._gl.vertexAttribDivisor(this._colorAttribute, 0); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); - this._gl.vertexAttribDivisor(this._selectedAttribute, 0); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); - this._gl.vertexAttribDivisor(this._orderAttribute, 0); - this._gl.vertexAttribDivisor(this._idAttribute, 0); - this._gl.vertexAttribDivisor(this._idColorAttribute, 0); - } - } - class UnitBlock extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } - } - class UnitSphere extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - } - class UnitCylinder extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } - } - class UnitSdf extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); - } - } - class Background extends ShaderBase { - constructor(core, main) { - super(core, main); - this._quad = new Quad$1(); - } - initializeContext(gl) { - super.initializeContext(gl); - this._quad.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._isInitialized = true; - this._vao = gl.createVertexArray(); - gl.bindVertexArray(this._vao); - gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); - gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - gl.enableVertexAttribArray(this._positionAttribute); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); - gl.bindVertexArray(null); - } - apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindVertexArray(this._vao); - } - } - class Ssao extends ShaderBase { - get texture2D1() { - return this._texture2D1; - } - set texture2D1(value2) { - if (this._texture2D1 != value2) { - this._texture2D1 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D2() { - return this._texture2D2; - } - set texture2D2(value2) { - if (this._texture2D2 != value2) { - this._texture2D2 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D3() { - return this._texture2D3; - } - set texture2D3(value2) { - if (this._texture2D3 != value2) { - this._texture2D3 = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); - this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); - this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); - this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); - this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); - this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); - this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); - } - applyView() { - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } - } - class Box extends ShaderBase { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - class Deferred extends ShaderBase { - get texture2D1() { - return this._texture2D1; - } - set texture2D1(value2) { - if (this._texture2D1 != value2) { - this._texture2D1 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D2() { - return this._texture2D2; - } - set texture2D2(value2) { - if (this._texture2D2 != value2) { - this._texture2D2 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D3() { - return this._texture2D3; - } - set texture2D3(value2) { - if (this._texture2D3 != value2) { - this._texture2D3 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D4() { - return this._texture2D4; - } - set texture2D4(value2) { - if (this._texture2D4 != value2) { - this._texture2D4 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D5() { - return this._texture2D5; - } - set texture2D5(value2) { - if (this._texture2D5 != value2) { - this._texture2D5 = value2; - this._haveTexturesChanged = true; - } - } - constructor(core, main) { - super(core, main); - this.directionToKeyLight = create$6(); - this.directionToFillLight1 = create$6(); - this.directionToFillLight2 = create$6(); - this.keyLightHalfAngle = create$6(); - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); - this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); - this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); - this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); - this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); - this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); - this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); - this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); - this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); - this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); - this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); - this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); - this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); - this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); - this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); - this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); - this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); - this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); - this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); - this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); - this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); - this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); - this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); - this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); - this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } - } - class Combine extends ShaderBase { - get texture2D1() { - return this._texture2D1; - } - set texture2D1(value2) { - if (this._texture2D1 != value2) { - this._texture2D1 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D2() { - return this._texture2D2; - } - set texture2D2(value2) { - if (this._texture2D2 != value2) { - this._texture2D2 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D3() { - return this._texture2D3; - } - set texture2D3(value2) { - if (this._texture2D3 != value2) { - this._texture2D3 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D4() { - return this._texture2D4; - } - set texture2D4(value2) { - if (this._texture2D4 != value2) { - this._texture2D4 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D5() { - return this._texture2D5; - } - set texture2D5(value2) { - if (this._texture2D5 != value2) { - this._texture2D5 = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1f(this._intensityUniform, this.intensity); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } - } - class DofBlur extends ShaderBase { - get texture2D1() { - return this._texture2D1; - } - set texture2D1(value2) { - if (this._texture2D1 != value2) { - this._texture2D1 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D2() { - return this._texture2D2; - } - set texture2D2(value2) { - if (this._texture2D2 != value2) { - this._texture2D2 = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); - this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); - this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); - this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); - this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - } - } - class Downsample extends ShaderBase { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - class Gaussian extends ShaderBase { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - class DofCombine extends ShaderBase { - get texture2D1() { - return this._texture2D1; - } - set texture2D1(value2) { - if (this._texture2D1 != value2) { - this._texture2D1 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D2() { - return this._texture2D2; - } - set texture2D2(value2) { - if (this._texture2D2 != value2) { - this._texture2D2 = value2; - this._haveTexturesChanged = true; - } - } - get texture2D3() { - return this._texture2D3; - } - set texture2D3(value2) { - if (this._texture2D3 != value2) { - this._texture2D3 = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._apertureUniform, this.aperture); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } - } - class Fxaa extends ShaderBase { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - class Bright extends ShaderBase { - get texture2D() { - return this._texture2D; - } - set texture2D(value2) { - if (this._texture2D != value2) { - this._texture2D = value2; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } else { - this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - class AxesVisualBase { - get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; - } - constructor(core) { - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; - } - update(elapsedTime) { - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() { - } - _renderText() { - } - } - class Cartesian2dVisual extends AxesVisualBase { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes) { - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = () => { - this._hasChanged = true; - }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 255; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 2; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - _renderGrid() { - const gridShader = this._main.gridShader; - const axes = this._axes; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for (let axisId = 0; axisId < 2; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width3 = gridTicksScale[0]; - const height3 = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width3, height3); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width2 = size[axisId2]; - const height2 = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for (let face = 0; face < 2; face++) { - const faceId = face; - if (axes.getIsForwardFace(faceId)) { - this._renderGridFace(faceId, width2, height2); - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width2, height2) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width2, height2) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - } - class Cartesian3dVisual extends AxesVisualBase { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes) { - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = () => { - this._hasChanged = true; - }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 255; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 3; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width2 = gridTicksScale[0]; - const height2 = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width2, height2); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width2 = size[axisId2]; - const height2 = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { - this._renderGridFace(faceId, width2, height2); - } - } - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width2, height2) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width2, height2) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width2; - gridShader.faceHeight = height2; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - } - class FontVisual { - get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; - } - constructor(core, font2) { - this._core = core; - this._font = font2; - font2.hasChangedCallback = () => { - this._hasChanged = true; - }; - } - initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) { - this._hasChanged = true; - } - } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); - } - } - } - class LabelVisualBase { - get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label2) { - this._core = core; - this._main = main; - this._label = label2; - this._label.hasChangedCallback = () => { - this._hasChanged = true; - }; - this._mMatrix = create$7(); - this.mMatrix = create$7(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._label.isInitialized) { - this._label.initialize(); - } - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 255; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - } - class LabelVisual extends LabelVisualBase { - get label() { - return this._label; - } - set text(value2) { - this._label.text = value2; - } - get text() { - return this._label.text; - } - constructor(core, main, label2) { - super(core, main, label2); - } - } - class LabelSetVisual extends LabelVisualBase { - get label() { - return this._label; - } - constructor(core, main, label2) { - super(core, main, label2); - } - } - class ImageVisual { - get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; - } - get image() { - return this._image; - } - constructor(core, main, image2) { - this._core = core; - this._main = main; - this._image = image2; - this._image.hasChangedCallback = () => { - this._hasChanged = true; - }; - this.mMatrix = create$7(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._image.isInitialized) { - this._image.initialize(); - } - this._gl = gl; - if (this._image.imageData) { - this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); - } - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.apply(); - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - class Lasso { - get isInitialized() { - return this._isInitialized; - } - get vertexBuffer() { - return this._vertexBuffer; - } - get indexBuffer() { - return this._indexBuffer; - } - get indexCount() { - return this._indexCount; - } - initializeContext(gl) { - const vertices = Quad$3.textured(Constants$1.MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$3.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - } - var __awaiter$1 = function(thisArg, _arguments, P, generator) { - function adopt(value2) { - return value2 instanceof P ? value2 : new P(function(resolve2) { - resolve2(value2); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value2) { - try { - step(generator.next(value2)); - } catch (e) { - reject(e); - } - } - function rejected(value2) { - try { - step(generator["throw"](value2)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - class Main extends RendererBase { - get shaderResources() { - return this._shaderResources; - } - get textureShader() { - return this._textureShader; - } - get lassoShader() { - return this._lassoShader; - } - get sdfTextShader() { - return this._sdfTextShader; - } - get gridShader() { - return this._gridShader; - } - get blockShader() { - return this._blockShader; - } - get sphereShader() { - return this._sphereShader; - } - get cyclinderShader() { - return this._cylinderShader; - } - get sdfShader() { - return this._sdfShader; - } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; - } - set currentAxes(value2) { - if (this._isAxes1Current) { - this._axes1 = value2; - } else { - this._axes2 = value2; - } - } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; - } - set previousAxes(value2) { - if (this._isAxes1Current) { - this._axes2 = value2; - } else { - this._axes1 = value2; - } - } - get config() { - return this._config; - } - constructor(options2) { - super(options2); - this._config = new Config(); - this._quad = new Quad$1(); - this._lasso = new Lasso(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = create$5(); - this._position = create$6(); - this._direction = create$6(); - this._cameraRotation = create$8(); - this._cameraPosition = create$6(); - this._modelPosition = create$6(); - this._modelManipulationOrigin = create$6(); - this._shadowVMatrix = create$7(); - this._shadowPMatrix = create$7(); - } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; - } - initialize(core) { - super.initialize(core); - this._shaderResources = new Resources(); - this._textureShader = new Texture(core, this); - this._lassoShader = new Lasso$1(core, this); - this._sdfTextShader = new SdfText(core, this); - this._gridShader = new PickGrid(core, this); - this._blockShader = new UnitBlock(core, this); - this._sphereShader = new UnitSphere(core, this); - this._cylinderShader = new UnitCylinder(core, this); - this._sdfShader = new UnitSdf(core, this); - this._backgroundShader = new Background(core, this); - this._ssaoShader = new Ssao(core, this); - this._boxShader = new Box(core, this); - this._deferredShader = new Deferred(core, this); - this._combineShader = new Combine(core, this); - this._dofBlurShader = new DofBlur(core, this); - this._downsampleShader = new Downsample(core, this); - this._gaussianShader = new Gaussian(core, this); - this._dofCombineShader = new DofCombine(core, this); - this._fxaaShader = new Fxaa(core, this); - this._brightPassShader = new Bright(core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event2) => { - this._core.log.write(LogLevel.warn, "WebGL context lost"); - event2.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", () => { - this._initializeContext(this._createContext(this._canvas)); - this._core.log.write(LogLevel.info, "WebGL context restored"); - }, false); - this._isInitialized = true; - } - _initializeContext(gl) { - this._gl = gl; - for (const key2 in this.fonts) { - const fontVisual = this.fonts[key2]; - fontVisual.initializeContext(gl); - } - this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); - const random2 = new PseudoRandom(0); - const _vec3 = create$6(); - for (let i = 0; i < this._config.ssaoKernelSize; i++) { - _vec3[0] = random2.nextFloat() * 2 - 1; - _vec3[1] = random2.nextFloat() * 2 - 1; - _vec3[2] = random2.nextFloat(); - normalize$5(_vec3, _vec3); - scale$5(_vec3, _vec3, random2.nextFloat()); - let scale2 = i / this._config.ssaoKernelSize; - scale2 = MathHelper.lerp(0.1, 1, scale2 * scale2); - scale$5(_vec3, _vec3, scale2); - this._ssaoSampleKernel[i * 3] = _vec3[0]; - this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; - this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; - } - const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); - _vec3[2] = 0; - for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { - _vec3[0] = random2.nextFloat() * 2 - 1; - _vec3[1] = random2.nextFloat() * 2 - 1; - normalize$5(_vec3, _vec3); - noise[i * 4] = _vec3[0]; - noise[i * 4 + 1] = _vec3[1]; - } - this._ssaoNoiseTexture = this._gl.createTexture(); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); - this._ssaoWidth = -1; - this._ssaoHeight = -1; - this._shadowWidth = -1; - this._shadowHeight = -1; - this._shaderResources.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._backgroundShader.initializeContext(this._gl); - this._ssaoShader.initializeContext(this._gl); - this._boxShader.initializeContext(this._gl); - this._deferredShader.initializeContext(this._gl); - this._combineShader.initializeContext(this._gl); - this._dofBlurShader.initializeContext(this._gl); - this._downsampleShader.initializeContext(this._gl); - this._gaussianShader.initializeContext(this._gl); - this._dofCombineShader.initializeContext(this._gl); - this._fxaaShader.initializeContext(this._gl); - this._brightPassShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._framebuffers = [null, null]; - const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - for (let i = 0; i < this.transitionBuffers.length; i++) { - this.transitionBuffers[i].initializeContext(this._gl); - } - if (this._axes1) { - for (let i = 0; i < this._axes1.length; i++) { - this._axes1[i].initializeContext(this._gl); - } - } - if (this._axes2) { - for (let i = 0; i < this._axes2.length; i++) { - this._axes2[i].initializeContext(this._gl); - } - } - for (let i = 0; i < this.labelSets.length; i++) { - this.labelSets[i].initializeContext(this._gl); - } - for (let i = 0; i < this.images.length; i++) { - this.images[i].initializeContext(this._gl); - } - } - _resize(width2, height2) { - super._resize(width2, height2); - this._positionTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); - this._colorTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._normalTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._geometryFrameBuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width2, height2); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._gl.drawBuffers([this._gl.COLOR_ATTACHMENT0, this._gl.COLOR_ATTACHMENT1, this._gl.COLOR_ATTACHMENT2]); - this._postProcessTexture1 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessDepthTexture = TextureHelper.create(this._gl, width2, height2, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); - this._postProcessTexture2 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); - this._postProcessDofTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); - this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); - const widthHalf = Math.round(width2 / 2); - const heightHalf = Math.round(height2 / 2); - this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); - this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); - this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); - this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); - const widthSixteenth = Math.round(widthEighth / 2); - const hgeightSixteenth = Math.round(heightEighth / 2); - this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); - this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); - this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); - } - _createContext(canvas) { - let supported = false; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; - const options2 = { - stencil: true, - alpha: false, - antialias: false, - preserveDrawingBuffer - }; - const gl = canvas.getContext("webgl2", options2); - if (gl) { - const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); - if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { - const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); - const framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); - if (status == gl.FRAMEBUFFER_COMPLETE) { - supported = true; - } - gl.bindTexture(gl.TEXTURE_2D, null); - } - } - return supported ? gl : null; - } - prepare() { - let viewport; - switch (this._core.config.stereoMode) { - case StereoMode.none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case StereoMode.left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case StereoMode.right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - break; - } - } - createTransitionBuffer(ids) { - const buffer = new TransitionBuffer(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; - } - createCartesian2dAxesVisual(axes) { - const visual = new Cartesian2dVisual(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - createCartesian3dAxesVisual(axes) { - const visual = new Cartesian3dVisual(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - _createLabelVisual(label2) { - return new LabelVisual(this._core, this, label2); - } - createLabelSetVisual(labelSet) { - const visual = new LabelSetVisual(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; - } - createImageVisual(image2) { - const visual = new ImageVisual(this._core, this, image2); - visual.initializeContext(this._gl); - return visual; - } - createFontVisual(font2) { - const visual = new FontVisual(this._core, font2); - visual.initializeContext(this._gl); - return visual; - } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); - } - update(elapsedTime) { - super.update(elapsedTime); - if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { - this._shadowWidth = this._config.shadowWidth; - this._shadowHeight = this._config.shadowHeight; - this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._shadowFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); - this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); - } - if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { - this._ssaoWidth = this._config.ssaoWidth; - this._ssaoHeight = this._config.ssaoHeight; - this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); - this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); - this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); - } - if (this._config.isDofEnabled && this._config.dofAutoFocus) { - this._core.getModelManipulationOrigin(this._modelManipulationOrigin); - this._core.getModelPosition(this._modelPosition); - add$4(this._position, this._modelManipulationOrigin, this._modelPosition); - this._core.camera.getPosition(this._cameraPosition); - subtract(this._position, this._position, this._cameraPosition); - const distance2 = -this._position[2]; - const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); - this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance2, amount); - } - } - render(elapsedTime) { - return __awaiter$1(this, void 0, void 0, function* () { - this._gl.enable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.cullFace(this._gl.BACK); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); - if (this.config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.clear(this._gl.DEPTH_BUFFER_BIT); - perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); - set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - fromMat4(this._cameraRotation, this.inverseVMatrices[0]); - transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); - add$4(this._position, this._position, this._modelPosition); - lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants$1.VECTOR3_UNITY); - } - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - this._renderTransitionBuffer(transitionBuffer); - } - } - const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; - if (axesVisuals) { - for (let i = 0; i < axesVisuals.length; i++) { - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.geometryFramebuffer = this._geometryFrameBuffer; - axesVisual.render(elapsedTime); - } - } - } - if (this.areLabelsVisible) { - for (let i = 0; i < this.labelSets.length; i++) { - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; - labelSetVisual.render(elapsedTime); - } - } - } - if (this.areImagesVisible) { - for (let i = 0; i < this.images.length; i++) { - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.geometryFramebuffer = this._geometryFrameBuffer; - imageVisual.render(elapsedTime); - } - } - } - if (this._backgroundShader.isInitialized) { - this._backgroundShader.prepare(); - this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._backgroundShader.apply(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._gl.bindVertexArray(null); - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = PickHelper.decodeType(this._pickedPixels); - set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); - this._pickedId = PickHelper.decodeNumber(this._pickedPixels); - } else { - set$7(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { - const viewport = this._viewportOffset; - this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for (let i = 0; i < this._viewportCount; i++) { - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - }); - } - _renderTransitionBuffer(transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; - const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = currentBuffer.from; - this._blockShader.rangeMax = currentBuffer.to; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._blockShader.vMatrix = this.vMatrices[viewport]; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = true; - this._blockShader.vMatrix = this._shadowVMatrix; - this._blockShader.pMatrix = this._shadowPMatrix; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.isShadowMap = false; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = currentBuffer.from; - this._sphereShader.rangeMax = currentBuffer.to; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sphereShader.vMatrix = this.vMatrices[viewport]; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = true; - this._sphereShader.vMatrix = this._shadowVMatrix; - this._sphereShader.pMatrix = this._shadowPMatrix; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.isShadowMap = false; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = currentBuffer.from; - this._cylinderShader.rangeMax = currentBuffer.to; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._cylinderShader.vMatrix = this.vMatrices[viewport]; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = true; - this._cylinderShader.vMatrix = this._shadowVMatrix; - this._cylinderShader.pMatrix = this._shadowPMatrix; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.isShadowMap = false; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = currentBuffer.from; - this._sdfShader.rangeMax = currentBuffer.to; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sdfShader.vMatrix = this.vMatrices[viewport]; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = true; - this._sdfShader.vMatrix = this._shadowVMatrix; - this._sdfShader.pMatrix = this._shadowPMatrix; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.isShadowMap = false; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - } - _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { - if (this._deferredShader.isInitialized) { - this._gl.disable(this._gl.DEPTH_TEST); - let ssaoTexture; - if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { - this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); - ssaoTexture = this._ssaoTexture1; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); - this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; - this._ssaoShader.indexBuffer = this._quad.indexBuffer; - this._ssaoShader.texture2D1 = this._positionTexture; - this._ssaoShader.texture2D2 = this._normalTexture; - this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; - this._ssaoShader.prepare(); - this._ssaoShader.pMatrix = pMatrix; - this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; - this._ssaoShader.ssaoRadius = this._config.ssaoRadius; - this._ssaoShader.ssaoPower = this._config.ssaoPower; - this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; - this._ssaoShader.left = 0; - this._ssaoShader.top = 0; - this._ssaoShader.width = this._config.ssaoWidth; - this._ssaoShader.height = this._config.ssaoHeight; - this._ssaoShader.apply(); - this._ssaoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { - ssaoTexture = this._ssaoTexture2; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); - this._boxShader.vertexBuffer = this._quad.vertexBuffer; - this._boxShader.indexBuffer = this._quad.indexBuffer; - this._boxShader.texture2D = this._ssaoTexture1; - this._boxShader.prepare(); - this._boxShader.left = 0; - this._boxShader.top = 0; - this._boxShader.width = this._config.ssaoWidth; - this._boxShader.height = this._config.ssaoHeight; - this._boxShader.apply(); - this._boxShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); - let postProcessFrameBuffer = this._postProcessFrameBuffer1; - this._shaderResources.bindFramebuffer(postProcessFrameBuffer); - this._deferredShader.vertexBuffer = this._quad.vertexBuffer; - this._deferredShader.indexBuffer = this._quad.indexBuffer; - this._deferredShader.texture2D1 = this._positionTexture; - this._deferredShader.texture2D2 = this._colorTexture; - this._deferredShader.texture2D3 = this._normalTexture; - this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; - this._deferredShader.texture2D5 = this._shadowDepthTexture; - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); - this._deferredShader.prepare(); - this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; - this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; - this._deferredShader.inverseVMatrix = inverseVMatrix; - this._deferredShader.shadowVMatrix = this._shadowVMatrix; - this._deferredShader.shadowPMatrix = this._shadowPMatrix; - this._deferredShader.vMatrix = vMatrix; - this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; - this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; - this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; - this._core.camera.getPosition(this._cameraPosition); - fromMat4(this._cameraRotation, vMatrix); - set$8(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - normalize$5(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); - subtract(this._direction, this._cameraPosition, this._position); - normalize$5(this._direction, this._direction); - add$4(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); - normalize$5(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); - copy$6(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); - copy$6(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); - this._deferredShader.left = viewport.left; - this._deferredShader.top = viewport.top; - this._deferredShader.width = viewport.width; - this._deferredShader.height = viewport.height; - this._deferredShader.shadowMapWidth = this._config.shadowWidth; - this._deferredShader.shadowMapHeight = this._config.shadowHeight; - this._deferredShader.ambientIntensity = this._config.ambientIntensity; - this._deferredShader.materialIntensity = this._config.materialIntensity; - this._deferredShader.specularPower = this._config.specularPower; - this._deferredShader.specularIntensity = this._config.specularIntensity; - this._deferredShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - const widthHalf = Math.round(viewport.width / 2); - const heightHalf = Math.round(viewport.height / 2); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - const widthSixteenth = Math.round(widthEighth / 2); - const heightSixteenth = Math.round(heightEighth / 2); - if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; - this._dofBlurShader.indexBuffer = this._quad.indexBuffer; - this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofBlurShader.texture2D2 = this._positionTexture; - this._dofBlurShader.prepare(); - this._dofBlurShader.focusDepth = this._config.dofFocusDistance; - this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; - this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; - this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; - this._dofBlurShader.left = viewport.left; - this._dofBlurShader.top = viewport.top; - this._dofBlurShader.width = viewport.width; - this._dofBlurShader.height = viewport.height; - this._dofBlurShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; - this._dofCombineShader.indexBuffer = this._quad.indexBuffer; - this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofCombineShader.texture2D2 = this._postProcessDofTexture; - this._dofCombineShader.prepare(); - this._dofCombineShader.focusDepth = this._config.dofFocusDistance; - this._dofCombineShader.left = viewport.left; - this._dofCombineShader.top = viewport.top; - this._dofCombineShader.width = viewport.width; - this._dofCombineShader.height = viewport.height; - this._dofCombineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthHalf; - this._brightPassShader.height = heightHalf; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessHalfTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthQuarter; - this._brightPassShader.height = heightQuarter; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessQuarterTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthEighth; - this._brightPassShader.height = heightEighth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessEighthTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthSixteenth; - this._brightPassShader.height = heightSixteenth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessHalfTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthHalf; - this._gaussianShader.height = heightHalf; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessHalfTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessQuarterTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthQuarter; - this._gaussianShader.height = heightQuarter; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessQuarterTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessEighthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthEighth; - this._gaussianShader.height = heightEighth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessEighthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthSixteenth; - this._gaussianShader.height = heightSixteenth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; - this._fxaaShader.indexBuffer = this._quad.indexBuffer; - this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._fxaaShader.prepare(); - this._fxaaShader.left = viewport.left; - this._fxaaShader.top = viewport.top; - this._fxaaShader.width = viewport.width; - this._fxaaShader.height = viewport.height; - this._fxaaShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._combineShader.vertexBuffer = this._quad.vertexBuffer; - this._combineShader.indexBuffer = this._quad.indexBuffer; - this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - if (this._config.isBloomEnabled) { - this._combineShader.texture2D2 = this._postProcessHalfTexture1; - this._combineShader.texture2D3 = this._postProcessQuarterTexture1; - this._combineShader.texture2D4 = this._postProcessEighthTexture1; - this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; - } else { - this._combineShader.texture2D2 = null; - this._combineShader.texture2D3 = null; - this._combineShader.texture2D4 = null; - this._combineShader.texture2D5 = null; - } - this._combineShader.prepare(); - this._combineShader.viewport = viewport; - this._combineShader.intensity = this._config.bloomIntensity; - this._combineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - (function(thisArg, _arguments, P, generator) { - function adopt(value2) { - return value2 instanceof P ? value2 : new P(function(resolve2) { - resolve2(value2); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value2) { - try { - step(generator.next(value2)); - } catch (e) { - reject(e); - } - } - function rejected(value2) { - try { - step(generator["throw"](value2)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }); - class MaterialBufferData extends Float32Array { - constructor(count2) { - super(count2 * MaterialBufferData.SIZE); - this.TYPE_OFFSET = 0 / 4; - this.FUZZ_OFFSET = 4 / 4; - this.REFRACTIVE_INDEX_OFFSET = 8 / 4; - this.TEXTURE_ID_OFFSET = 12 / 4; - this.COLOR_OFFSET = 16 / 4; - this.GLOSSINESS_OFFSET = 28 / 4; - this.ID_COLOR_OFFSET = 32 / 4; - this.DENSITY_OFFSET = 48 / 4; - } - getType(index2) { - return this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET]; - } - setType(index2, value2) { - this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; - } - getFuzz(index2) { - return this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET]; - } - setFuzz(index2, value2) { - this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET] = value2; - } - getRefractiveIndex(index2) { - return this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET]; - } - setRefractiveIndex(index2, value2) { - this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET] = value2; - } - getTextureId(index2) { - return this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET]; - } - setTextureId(index2, value2) { - this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET] = value2; - } - getColor(index2, value2) { - const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setColor(index2, value2) { - const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getGlossiness(index2) { - return this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET]; - } - setGlossiness(index2, value2) { - this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET] = value2; - } - getDensity(index2) { - return this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET]; - } - setDensity(index2, value2) { - this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET] = value2; - } - getIdColor(index2, value2) { - const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; - set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); - } - setIdColor(index2, value2) { - const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - } - MaterialBufferData.SIZE = 64 / 4; - class TextureBufferData extends Float32Array { - constructor(count2) { - super(count2 * TextureBufferData.SIZE); - this.COLOR0_OFFSET = 0 / 4; - this.TYPE_OFFSET = 12 / 4; - this.COLOR1_OFFSET = 16 / 4; - this.SIZE0_OFFSET = 32 / 4; - this.SIZE1_OFFSET = 48 / 4; - this.CLIP_OFFSET = 64 / 4; - this.OFFSET_OFFSET = 80 / 4; - } - getType(index2) { - return this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET]; - } - setType(index2, value2) { - this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; - } - getColor0(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setColor0(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getColor1(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setColor1(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getSize0(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; - set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); - } - setSize0(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - getSize1(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; - set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); - } - setSize1(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - getClip(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; - set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); - } - setClip(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - getOffset(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; - set$5(value2, this[offset2], this[offset2 + 1]); - } - setOffset(index2, value2) { - const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - } - } - TextureBufferData.SIZE = 96 / 4; - class HittableBufferData extends Float32Array { - constructor(count2) { - super(count2 * HittableBufferData.SIZE); - this.CENTER0_OFFSET = 0 / 4; - this.TYPE_OFFSET = 12 / 4; - this.SIZE0_OFFSET = 16 / 4; - this.MATERIAL_ID_OFFSET = 28 / 4; - this.ROTATION0_OFFSET = 32 / 4; - this.ROTATION1_OFFSET = 48 / 4; - this.TEXCOORD0_OFFSET = 64 / 4; - this.TEXCOORD1_OFFSET = 72 / 4; - this.CENTER1_OFFSET = 80 / 4; - this.ROUNDING_OFFSET = 92 / 4; - this.SIZE1_OFFSET = 96 / 4; - this.BOUNDARY_TYPE_OFFSET = 108 / 4; - this.TIME0_OFFSET = 112 / 4; - this.TIME1_OFFSET = 116 / 4; - this.TEX_ID_OFFSET = 120 / 4; - this.SDF_BUFFER_OFFSET = 124 / 4; - this.SDF_BORDER_OFFSET = 128 / 4; - this.PARAMETER_1_OFFSET = 132 / 4; - this.PARAMETER_2_OFFSET = 136 / 4; - this.MATERIAL_FUZZ_OFFSET = 140 / 4; - this.MATERIAL_GLOSS_OFFSET = 144 / 4; - this.MATERIAL_DENSITY_OFFSET = 148 / 4; - this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; - this.MATERIAL_COLOR_OFFSET = 160 / 4; - this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; - this.SEGMENT_COLOR_OFFSET = 176 / 4; - this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; - this.TEXTURE_ID_OFFSET = 196 / 4; - } - getType(index2) { - return this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET]; - } - setType(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; - } - getCenter0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setCenter0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getCenter1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setCenter1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getTime0(index2) { - return this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET]; - } - setTime0(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET] = value2; - } - getTime1(index2) { - return this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET]; - } - setTime1(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET] = value2; - } - getSize0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setSize0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getSize1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setSize1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getRotation0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; - set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); - } - setRotation0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - getRotation1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; - set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); - } - setRotation1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - getTexCoord0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; - set$5(value2, this[offset2], this[offset2 + 1]); - } - setTexCoord0(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - } - getTexCoord1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; - set$5(value2, this[offset2], this[offset2 + 1]); - } - setTexCoord1(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - } - getRounding(index2) { - return this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET]; - } - setRounding(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET] = value2; - } - getParameter1(index2) { - return this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET]; - } - setParameter1(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET] = value2; - } - getParameter2(index2) { - return this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET]; - } - setParameter2(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET] = value2; - } - getBoundaryType(index2) { - return this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET]; - } - setBoundaryType(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET] = value2; - } - getTexId(index2) { - return this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET]; - } - setTexId(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET] = value2; - } - getSdfBuffer(index2) { - return this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET]; - } - setSdfBuffer(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET] = value2; - } - getSdfBorder(index2) { - return this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET]; - } - setSdfBorder(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET] = value2; - } - getMaterialTypeId(index2) { - return this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET]; - } - setMaterialTypeId(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET] = value2; - } - getMaterialFuzz(index2) { - return this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET]; - } - setMaterialFuzz(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET] = value2; - } - getMaterialDensity(index2) { - return this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET]; - } - setMaterialDensity(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET] = value2; - } - getMaterialGloss(index2) { - return this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET]; - } - setMaterialGloss(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET] = value2; - } - getMaterialRefractiveIndex(index2) { - return this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; - } - setMaterialRefractiveIndex(index2, value2) { - this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value2; - } - getMaterialColor(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; - value2[0] = this[offset2]; - value2[1] = this[offset2 + 1]; - value2[2] = this[offset2 + 2]; - } - setMaterialColor(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getSegmentColor(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; - value2[0] = this[offset2]; - value2[1] = this[offset2 + 1]; - value2[2] = this[offset2 + 2]; - value2[3] = this[offset2 + 3]; - } - setSegmentColor(index2, value2) { - const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - } - HittableBufferData.SIZE = 208 / 4; - class ComputeUniformBufferData extends Float32Array { - constructor() { - super(ComputeUniformBufferData.SIZE); - this.POSITION_OFFSET = 0 / 4; - this.WIDTH_OFFSET = 12 / 4; - this.RIGHT_OFFSET = 16 / 4; - this.HEIGHT_OFFSET = 28 / 4; - this.UP_OFFSET = 32 / 4; - this.SEED_OFFSET = 44 / 4; - this.FORWARD_OFFSET = 48 / 4; - this.FOV_OFFSET = 60 / 4; - this.BACKGROUND_COLOR_OFFSET = 64 / 4; - this.TIME0_OFFSET = 76 / 4; - this.AMBIENT_COLOR_OFFSET = 80 / 4; - this.TIME1_OFFSET = 92 / 4; - this.TILES_X = 96 / 4; - this.TILES_Y = 100 / 4; - this.TILE_OFFSET_X = 104 / 4; - this.TILE_OFFSET_Y = 108 / 4; - this.LOOKAT_OFFSET = 112 / 4; - this.APERTURE_OFFSET = 124 / 4; - this.FOCUS_DISTANCE_OFFSET = 128 / 4; - this.RAYS_PER_FRAME_OFFSET = 132 / 4; - } - getFocusDistance() { - return this[this.FOCUS_DISTANCE_OFFSET]; - } - setFocusDistance(value2) { - this[this.FOCUS_DISTANCE_OFFSET] = value2; - } - getWidth() { - return this[this.WIDTH_OFFSET]; - } - setWidth(value2) { - this[this.WIDTH_OFFSET] = value2; - } - getHeight() { - return this[this.HEIGHT_OFFSET]; - } - setHeight(value2) { - this[this.HEIGHT_OFFSET] = value2; - } - getSeed() { - return this[this.SEED_OFFSET]; - } - setSeed(value2) { - this[this.SEED_OFFSET] = value2; - } - getRaysPerFrame() { - return this[this.RAYS_PER_FRAME_OFFSET]; - } - setRaysPerFrame(value2) { - this[this.RAYS_PER_FRAME_OFFSET] = value2; - } - getFieldOfView() { - return this[this.FOV_OFFSET]; - } - setFieldOfView(value2) { - this[this.FOV_OFFSET] = value2; - } - getAperture() { - return this[this.APERTURE_OFFSET]; - } - setAperture(value2) { - this[this.APERTURE_OFFSET] = value2; - } - getPosition(value2) { - set$8(value2, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); - } - setPosition(value2) { - this[this.POSITION_OFFSET] = value2[0]; - this[this.POSITION_OFFSET + 1] = value2[1]; - this[this.POSITION_OFFSET + 2] = value2[2]; - } - getRight(value2) { - set$8(value2, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); - } - setRight(value2) { - this[this.RIGHT_OFFSET] = value2[0]; - this[this.RIGHT_OFFSET + 1] = value2[1]; - this[this.RIGHT_OFFSET + 2] = value2[2]; - } - getUp(value2) { - set$8(value2, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); - } - setUp(value2) { - this[this.UP_OFFSET] = value2[0]; - this[this.UP_OFFSET + 1] = value2[1]; - this[this.UP_OFFSET + 2] = value2[2]; - } - getForward(value2) { - set$8(value2, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); - } - setForward(value2) { - this[this.FORWARD_OFFSET] = value2[0]; - this[this.FORWARD_OFFSET + 1] = value2[1]; - this[this.FORWARD_OFFSET + 2] = value2[2]; - } - getBackgroundColor(value2) { - set$7(value2, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); - } - setBackgroundColor(value2) { - this[this.BACKGROUND_COLOR_OFFSET] = value2[0]; - this[this.BACKGROUND_COLOR_OFFSET + 1] = value2[1]; - this[this.BACKGROUND_COLOR_OFFSET + 2] = value2[2]; - this[this.BACKGROUND_COLOR_OFFSET + 3] = value2[3]; - } - getAmbientColor(value2) { - set$8(value2, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); - } - setAmbientColor(value2) { - this[this.AMBIENT_COLOR_OFFSET] = value2[0]; - this[this.AMBIENT_COLOR_OFFSET + 1] = value2[1]; - this[this.AMBIENT_COLOR_OFFSET + 2] = value2[2]; - } - getTime0() { - return this[this.TIME0_OFFSET]; - } - setTime0(value2) { - this[this.TIME0_OFFSET] = value2; - } - getTime1() { - return this[this.TIME1_OFFSET]; - } - setTime1(value2) { - this[this.TIME1_OFFSET] = value2; - } - getTilesX() { - return this[this.TILES_X]; - } - setTilesX(value2) { - this[this.TILES_X] = value2; - } - getTilesY() { - return this[this.TILES_Y]; - } - setTilesY(value2) { - this[this.TILES_Y] = value2; - } - getTileOffsetX() { - return this[this.TILE_OFFSET_X]; - } - setTileOffsetX(value2) { - this[this.TILE_OFFSET_X] = value2; - } - getTileOffsetY() { - return this[this.TILE_OFFSET_Y]; - } - setTileOffsetY(value2) { - this[this.TILE_OFFSET_Y] = value2; - } - getLookAt(value2) { - set$8(value2, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); - } - setLookAt(value2) { - this[this.LOOKAT_OFFSET] = value2[0]; - this[this.LOOKAT_OFFSET + 1] = value2[1]; - this[this.LOOKAT_OFFSET + 2] = value2[2]; - } - } - ComputeUniformBufferData.SIZE = 144 / 4; - class FullscreenQuadUniformBufferData extends Float32Array { - constructor() { - super(FullscreenQuadUniformBufferData.SIZE); - this.WIDTH_OFFSET = 0 / 4; - this.HEIGHT_OFFSET = 4 / 4; - this.SPP_OFFSET = 8 / 4; - this.EXPOSURE_OFFSET = 12 / 4; - this.MIN_DEPTH_OFFSET = 16 / 4; - this.MAX_DEPTH_OFFSET = 20 / 4; - this.EDGE_NORMAL_OFFSET = 24 / 4; - this.EDGE_DEPTH_OFFSET = 28 / 4; - this.EDGE_FOREGROUND_OFFSET = 32 / 4; - this.EDGE_BACKGROUND_OFFSET = 48 / 4; - } - getWidth() { - return this[this.WIDTH_OFFSET]; - } - setWidth(value2) { - this[this.WIDTH_OFFSET] = value2; - } - getHeight() { - return this[this.HEIGHT_OFFSET]; - } - setHeight(value2) { - this[this.HEIGHT_OFFSET] = value2; - } - getSamplesPerPixel() { - return this[this.SPP_OFFSET]; - } - setSamplesPerPixel(value2) { - this[this.SPP_OFFSET] = value2; - } - getExposure() { - return this[this.EXPOSURE_OFFSET]; - } - setExposure(value2) { - this[this.EXPOSURE_OFFSET] = value2; - } - getMinDepth() { - return this[this.MIN_DEPTH_OFFSET]; - } - setMinDepth(value2) { - this[this.MIN_DEPTH_OFFSET] = value2; - } - getMaxDepth() { - return this[this.MAX_DEPTH_OFFSET]; - } - setMaxDepth(value2) { - this[this.MAX_DEPTH_OFFSET] = value2; - } - getEdgeDepth() { - return this[this.EDGE_DEPTH_OFFSET]; - } - setEdgeDepth(value2) { - this[this.EDGE_DEPTH_OFFSET] = value2; - } - getEdgeNormal() { - return this[this.EDGE_NORMAL_OFFSET]; - } - setEdgeNormal(value2) { - this[this.EDGE_NORMAL_OFFSET] = value2; - } - getEdgeForeground(value2) { - set$7(value2, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); - } - setEdgeForeground(value2) { - this[this.EDGE_FOREGROUND_OFFSET] = value2[0]; - this[this.EDGE_FOREGROUND_OFFSET + 1] = value2[1]; - this[this.EDGE_FOREGROUND_OFFSET + 2] = value2[2]; - this[this.EDGE_FOREGROUND_OFFSET + 3] = value2[3]; - } - getEdgeBackground(value2) { - set$7(value2, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); - } - setEdgeBackground(value2) { - this[this.EDGE_BACKGROUND_OFFSET] = value2[0]; - this[this.EDGE_BACKGROUND_OFFSET + 1] = value2[1]; - this[this.EDGE_BACKGROUND_OFFSET + 2] = value2[2]; - this[this.EDGE_BACKGROUND_OFFSET + 3] = value2[3]; - } - } - FullscreenQuadUniformBufferData.SIZE = 64 / 4; - class LinearBVHNodeBufferData extends Float32Array { - constructor(count2) { - super(count2 * LinearBVHNodeBufferData.SIZE); - this.CENTER_OFFSET = 0 / 4; - this.SIZE_OFFSET = 16 / 4; - this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; - this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; - this.N_PRIMITIVES_OFFSET = 32 / 4; - this.AXIS_OFFSET = 36 / 4; - } - getCenter(index2, value2) { - const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setCenter(index2, value2) { - const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getSize(index2, value2) { - const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setSize(index2, value2) { - const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getPrimitivesOffset(index2) { - return this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET]; - } - setPrimitivesOffset(index2, value2) { - this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET] = value2; - } - getSecondChildOffset(index2) { - return this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET]; - } - setSecondChildOffset(index2, value2) { - this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET] = value2; - } - getNPrimitives(index2) { - return this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET]; - } - setNPrimitives(index2, value2) { - this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET] = value2; - } - getAxis(index2) { - return this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET]; - } - setAxis(index2, value2) { - this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET] = value2; - } - } - LinearBVHNodeBufferData.SIZE = 48 / 4; - class LightBufferData extends Float32Array { - constructor(count2) { - super(count2 * LightBufferData.SIZE); - this.ROTATION_OFFSET = 0 / 4; - this.CENTER_OFFSET = 16 / 4; - this.TYPE_OFFSET = 28 / 4; - this.SIZE_OFFSET = 32 / 4; - this.COLOR_OFFSET = 48 / 4; - } - getType(index2) { - return this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET]; - } - setType(index2, value2) { - this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; - } - getCenter(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setCenter(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getSize(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setSize(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getColor(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; - set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); - } - setColor(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - } - getRotation(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; - set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); - } - setRotation(index2, value2) { - const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; - this[offset2] = value2[0]; - this[offset2 + 1] = value2[1]; - this[offset2 + 2] = value2[2]; - this[offset2 + 3] = value2[3]; - } - } - LightBufferData.SIZE = 64 / 4; - (function(thisArg, _arguments, P, generator) { - function adopt(value2) { - return value2 instanceof P ? value2 : new P(function(resolve2) { - resolve2(value2); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value2) { - try { - step(generator.next(value2)); - } catch (e) { - reject(e); - } - } - function rejected(value2) { - try { - step(generator["throw"](value2)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }); - const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - MorphChartsCore: Core - }, Symbol.toStringTag, { value: "Module" })); - function concat(...args) { - return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []); - } - function allTruthy(...args) { - return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []).filter(Boolean); - } - function push$1(arr, items) { - arr.push.apply(arr, items); - } - function addEl(tagName, parentElement) { - const el = document.createElement(tagName); - parentElement.appendChild(el); - return el; - } - function addDiv(parentElement, className2) { - const div = addEl("div", parentElement); - if (className2) { - div.className = className2; - } - return div; - } - function outerSize$1(el) { - const cs = getComputedStyle(el); - const height2 = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); - const width2 = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); - return { height: height2, width: width2 }; - } - var isMergeableObject = function isMergeableObject2(value2) { - return isNonNullObject(value2) && !isSpecial(value2); - }; - function isNonNullObject(value2) { - return !!value2 && typeof value2 === "object"; - } - function isSpecial(value2) { - var stringValue = Object.prototype.toString.call(value2); - return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value2); - } - var canUseSymbol = typeof Symbol === "function" && Symbol.for; - var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103; - function isReactElement(value2) { - return value2.$$typeof === REACT_ELEMENT_TYPE; - } - function emptyTarget(val) { - return Array.isArray(val) ? [] : {}; - } - function cloneUnlessOtherwiseSpecified(value2, options2) { - return options2.clone !== false && options2.isMergeableObject(value2) ? deepmerge$1(emptyTarget(value2), value2, options2) : value2; - } - function defaultArrayMerge(target2, source2, options2) { - return target2.concat(source2).map(function(element2) { - return cloneUnlessOtherwiseSpecified(element2, options2); - }); - } - function mergeObject(target2, source2, options2) { - var destination = {}; - if (options2.isMergeableObject(target2)) { - Object.keys(target2).forEach(function(key2) { - destination[key2] = cloneUnlessOtherwiseSpecified(target2[key2], options2); - }); - } - Object.keys(source2).forEach(function(key2) { - if (!options2.isMergeableObject(source2[key2]) || !target2[key2]) { - destination[key2] = cloneUnlessOtherwiseSpecified(source2[key2], options2); - } else { - destination[key2] = deepmerge$1(target2[key2], source2[key2], options2); - } - }); - return destination; - } - function deepmerge$1(target2, source2, options2) { - options2 = options2 || {}; - options2.arrayMerge = options2.arrayMerge || defaultArrayMerge; - options2.isMergeableObject = options2.isMergeableObject || isMergeableObject; - var sourceIsArray = Array.isArray(source2); - var targetIsArray = Array.isArray(target2); - var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - if (!sourceAndTargetTypesMatch) { - return cloneUnlessOtherwiseSpecified(source2, options2); - } else if (sourceIsArray) { - return options2.arrayMerge(target2, source2, options2); - } else { - return mergeObject(target2, source2, options2); - } - } - deepmerge$1.all = function deepmergeAll(array2, options2) { - if (!Array.isArray(array2)) { - throw new Error("first argument should be an array"); - } - return array2.reduce(function(prev, next) { - return deepmerge$1(prev, next, options2); - }, {}); - }; - var deepmerge_1 = deepmerge$1; - const _deepmerge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - default: deepmerge_1 - }, Symbol.toStringTag, { value: "Module" })); - function isObject$1(o) { - return Object.prototype.toString.call(o) === "[object Object]"; - } - function isPlainObject(o) { - var ctor, prot; - if (isObject$1(o) === false) return false; - ctor = o.constructor; - if (ctor === void 0) return true; - prot = ctor.prototype; - if (isObject$1(prot) === false) return false; - if (prot.hasOwnProperty("isPrototypeOf") === false) { - return false; - } - return true; - } - const deepmerge = deepmerge_1 || _deepmerge; - function clone(objectToClone) { - if (!objectToClone) - return objectToClone; - return deepmerge.all([objectToClone]); - } - const dontMerge = (destination, source2) => source2; - function deepMerge(...objectsToMerge) { - const objects = objectsToMerge.filter(Boolean); - return deepmerge.all(objects, { arrayMerge: dontMerge, isMergeableObject: isPlainObject }); - } - function rgbToDeckglColor(c2) { - return [c2.r, c2.g, c2.b, c2.opacity * 255]; - } - function colorIsEqual(a2, b2) { - if (a2.length !== b2.length) - return false; - for (let i = 0; i < a2.length; i++) { - if (a2[i] !== b2[i]) - return false; - } - return true; - } - function colorFromString(cssColorSpecifier) { - if (cssColorSpecifier) { - const dc = color$2(cssColorSpecifier); - if (dc) { - const c2 = dc.rgb(); - return rgbToDeckglColor(c2); - } - } - } - function colorToString(color2) { - const c2 = [...color2]; - if (c2.length > 3) { - c2[3] /= 255; - } - return `rgba(${c2.join(",")})`; - } - function desaturate(color2, value2) { - const rgb2 = rgb$1(color2[0], color2[1], color2[2], color2[3] / 255); - const hslColor = hsl$1(rgb2); - hslColor.s = value2; - const c2 = hslColor.rgb(); - return rgbToDeckglColor(c2); - } - const util$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - addDiv, - addEl, - allTruthy, - clone, - colorFromString, - colorIsEqual, - colorToString, - concat, - createElement, - deepMerge, - desaturate, - getActiveElementInfo, - mount, - outerSize: outerSize$1, - push: push$1, - setActiveElement - }, Symbol.toStringTag, { value: "Module" })); - const minHeight = "100px"; - const minWidth = "100px"; - const defaultPresenterStyle$1 = { - cssPrefix: "vega-morphcharts-", - defaultCubeColor: [128, 128, 128, 255], - highlightColor: [0, 0, 0, 255] - }; - const defaultPresenterConfig = { - onCubeClick: (e, cube) => { - }, - onCubeHover: (e, cube) => { - }, - transitionDurations: { - position: 600, - stagger: 600, - view: 600 - }, - renderer: { - advanced: false, - advancedOptions: {}, - basicOptions: { - antialias: true - } - } - }; - function createStage(view) { - const stage = { - view, - cubeData: [], - pathData: [], - axes: { - x: [], - y: [], - z: [] - }, - gridLines: [], - textData: [], - legend: { - rows: {} - }, - facets: [] - }; - return stage; - } - const groupStrokeWidth = 1; - const lineZ = 0; - const defaultView$1 = "2d"; - const minZ = 0.5; - const min3dDepth = 0.05; - const minPixelSize = 0.5; - const zAxisEncodeColor = [7, 7, 7, 255]; - const zAxisOutColor = [0, 0, 0, 255]; - function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { - if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { - stageItem.color = zAxisOutColor; - if (currAxis.axisRole !== "z") { - const previousAxisRole = removeCurrentAxes(stage, currAxis); - if (previousAxisRole) { - currAxis.axisRole = "z"; - stage.axes.z.push(currAxis); - } - } - } - } - function removeCurrentAxes(stage, currAxis) { - for (const axisRole in stage.axes) { - const axes = stage.axes[axisRole]; - for (let i = 0; i < axes.length; i++) { - if (axes[i] === currAxis) { - axes.splice(i, 1); - return axisRole; - } - } - } - } - const defaults$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - createStage, - defaultOnAxisItem, - defaultPresenterConfig, - defaultPresenterStyle: defaultPresenterStyle$1, - defaultView: defaultView$1, - groupStrokeWidth, - lineZ, - min3dDepth, - minHeight, - minPixelSize, - minWidth, - minZ - }, Symbol.toStringTag, { value: "Module" })); - const vega$1 = { - CanvasHandler: null, - inferType: null, - inferTypes: null, - loader: null, - parse: null, - read: null, - renderModule: null, - Renderer: null, - sceneVisit: null, - scheme: null, - truncate: null, - View: null - }; - const base$3 = { - vega: vega$1 - }; - function use$5(vega2) { - base$3.vega = vega2; - } - var PresenterElement$1; - (function(PresenterElement2) { - PresenterElement2[PresenterElement2["root"] = 0] = "root"; - PresenterElement2[PresenterElement2["gl"] = 1] = "gl"; - PresenterElement2[PresenterElement2["panel"] = 2] = "panel"; - PresenterElement2[PresenterElement2["legend"] = 3] = "legend"; - PresenterElement2[PresenterElement2["vegaControls"] = 4] = "vegaControls"; - })(PresenterElement$1 || (PresenterElement$1 = {})); - const LegendView = (props) => { - const rows = []; - const addRow = (row, i) => { - const fn2 = symbolMap[row.symbol.shape]; - let jsx; - if (fn2) { - jsx = fn2(row.symbol); - } else { - jsx = createElement("span", null, "x"); - } - rows.push({ - cells: [ - { className: "symbol", content: jsx }, - { className: "label", content: row.label, title: row.label } - ] - }); - }; - const sorted = Object.keys(props.legend.rows).sort((a2, b2) => +a2 - +b2); - sorted.forEach((i) => addRow(props.legend.rows[i])); - if (sorted.length) { - return createElement(Table$1, { rows, rowClassName: "legend-row", onRowClick: (e, i) => props.onClick(e, props.legend, i) }, props.legend.title !== void 0 && createElement( - "tr", - { onClick: (e) => props.onClick(e, props.legend, null) }, - createElement("th", { colSpan: 2 }, props.legend.title) - )); - } - }; - const symbolMap = { - square: function(symbol2) { - return createElement("div", { style: { - height: `${symbol2.bounds.y2 - symbol2.bounds.y1}px`, - width: `${symbol2.bounds.x2 - symbol2.bounds.x1}px`, - backgroundColor: symbol2.fill, - borderColor: symbol2.fill - } }); - } - }; - function initializePanel(presenter) { - const rootDiv = createElement( - "div", - { className: className$1(PresenterElement$1.root, presenter) }, - createElement("div", { className: className$1(PresenterElement$1.gl, presenter), style: { minHeight, minWidth } }), - createElement( - "div", - { className: className$1(PresenterElement$1.panel, presenter) }, - createElement("div", { className: className$1(PresenterElement$1.vegaControls, presenter) }), - createElement("div", { className: className$1(PresenterElement$1.legend, presenter) }) - ) - ); - mount(rootDiv, presenter.el); - } - function className$1(type2, presenter) { - return `${presenter.style.cssPrefix}${PresenterElement$1[type2]}`; - } - function patchCubeArray(allocatedSize, empty, cubes) { - const patched = new Array(allocatedSize); - patched.fill(empty); - cubes.forEach((cube) => patched[cube.ordinal] = cube); - return patched; - } - const legendMap = { - "legend-title": function(legend2, textItem) { - legend2.title = textItem.text; - }, - "legend-symbol": function(legend2, symbol2) { - const { bounds: bounds2, fill: fill2, shape: shape2 } = symbol2; - const legendRowSymbol = { bounds: bounds2, fill: fill2, shape: shape2 }; - const i = symbol2.datum.index; - legend2.rows[i] = legend2.rows[i] || {}; - legend2.rows[i].symbol = legendRowSymbol; - }, - "legend-label": function(legend2, label2) { - const i = label2.datum.index; - legend2.rows[i] = legend2.rows[i] || {}; - const row = legend2.rows[i]; - row.label = label2.text; - row.value = label2.datum.value; - } - }; - const markStager$5 = (options2, stage, scene, x2, y2, groupType) => { - base$3.vega.sceneVisit(scene, function(item) { - const fn2 = legendMap[item.mark.role]; - if (fn2) { - fn2(stage.legend, item); - } - }); - }; - const markStager$4 = (options2, stage, scene, x2, y2, groupType) => { - base$3.vega.sceneVisit(scene, function(item) { - const { bounds: bounds2, height: height2, url, width: width2 } = item; - let { x1: x12, x2: x22, y1: y12, y2: y22 } = bounds2; - x12 += x2; - x22 += x2; - y12 += y2; - y22 += y2; - if (!stage.backgroundImages) { - stage.backgroundImages = []; - } - stage.backgroundImages.push({ bounds: { x1: x12, x2: x22, y1: y12, y2: y22 }, height: height2, url, width: width2 }); - }); - }; - const markStager$3 = (options2, stage, scene, x2, y2, groupType) => { - base$3.vega.sceneVisit(scene, function(item) { - const noZ = item.z === void 0; - const z2 = noZ ? 0 : (item.z || 0) + minZ; - const depth = (noZ ? 0 : item.depth || 0) + min3dDepth; - const ty2 = -1; - const ordinal2 = options2.assignCubeOrdinal(item.datum); - if (ordinal2 > options2.maxOrdinal) { - options2.maxOrdinal = ordinal2; - } - if (ordinal2 === void 0) ; - else { - const cube = { - ordinal: ordinal2, - size: [item.width, item.height, depth], - position: [x2 + (+item.x || 0), ty2 * (y2 + (+item.y || 0)) - +item.height, z2], - color: colorFromString(item.fill) || options2.defaultCubeColor || [128, 128, 128, 128] - }; - cube.color[3] = item.opacity === void 0 ? 255 : 255 * item.opacity; - stage.cubeData.push(cube); - } - }); - }; - const markStager$2 = (options2, stage, scene, x2, y2, groupType) => { - base$3.vega.sceneVisit(scene, function(item) { - const x12 = item.x || 0; - const y12 = item.y || 0; - const x22 = item.x2 != null ? item.x2 : x12; - const y22 = item.y2 != null ? item.y2 : y12; - const lineItem = styledLine(x12 + x2, y12 + y2, x22 + x2, y22 + y2, item.stroke, item.strokeWidth); - const { currAxis } = options2; - if (options2.modifyAxis) { - options2.modifyAxis(item, lineItem, stage, currAxis); - } - if (item.mark.role === "axis-tick") { - currAxis.ticks.push(lineItem); - } else if (item.mark.role === "axis-domain") { - currAxis.domain = lineItem; - } else { - stage.gridLines.push(lineItem); - } - }); - }; - function styledLine(x12, y12, x2, y2, stroke2, strokeWidth) { - const line2 = { - sourcePosition: [x12, -y12, lineZ], - //-1 = change direction of y from SVG to GL - targetPosition: [x2, -y2, lineZ], - color: colorFromString(stroke2), - strokeWidth - }; - return line2; - } - function box(gx, gy, height2, width2, stroke2, strokeWidth, diagonals = false) { - const lines = [ - styledLine(gx, gy, gx + width2, gy, stroke2, strokeWidth), - styledLine(gx + width2, gy, gx + width2, gy + height2, stroke2, strokeWidth), - styledLine(gx + width2, gy + height2, gx, gy + height2, stroke2, strokeWidth), - styledLine(gx, gy + height2, gx, gy, stroke2, strokeWidth) - ]; - if (diagonals) { - lines.push(styledLine(gx, gy, gx + width2, gy + height2, stroke2, strokeWidth)); - lines.push(styledLine(gx, gy + height2, gx + width2, gy, stroke2, strokeWidth)); - } - return lines; - } - const ty = -1; - const markStager$1 = (options2, stage, scene, x2, y2, groupType) => { - const g = Object.assign({ opacity: 1, strokeOpacity: 1, strokeWidth: 1 }, scene.items[0]); - const path2 = { - strokeWidth: g.strokeWidth, - strokeColor: colorFromString(g.stroke), - positions: scene.items.map((it) => [ - it.x, - ty * it.y, - it.z || 0 - ]) - }; - path2.strokeColor[3] *= g.strokeOpacity; - path2.strokeColor[3] *= g.opacity; - stage.pathData.push(path2); - }; - const markStager = (options2, stage, scene, x2, y2, groupType) => { - const ty2 = -1; - base$3.vega.sceneVisit(scene, function(item) { - if (!item.text) - return; - const size = item.fontSize; - const yOffset = 0; - const textItem = { - color: colorFromString(item.fill), - text: item.limit === void 0 ? item.text : base$3.vega.truncate(item.text, item.limit, "right", item.ellipsis || "..."), - //use dots instead of unicode ellipsis for - position: [x2 + (item.x || 0), ty2 * (y2 + (item.y || 0) + yOffset), 0], - size, - angle: convertAngle(item.angle), - //textAnchor: convertAlignment(item.align), - //alignmentBaseline, - metaData: item.metaData - }; - const { currAxis } = options2; - if (options2.modifyAxis) { - options2.modifyAxis(item, textItem, stage, currAxis); - } - if (item.mark.role === "axis-label") { - const tickText = textItem; - tickText.value = item.datum.value; - currAxis.tickText.push(tickText); - } else if (item.mark.role === "axis-title") { - currAxis.title = textItem; - } else { - stage.textData.push(textItem); - } - }); - }; - function convertAngle(vegaTextAngle) { - if (vegaTextAngle && !isNaN(vegaTextAngle)) { - return 360 - vegaTextAngle; - } - return 0; - } - var GroupType; - (function(GroupType2) { - GroupType2[GroupType2["none"] = 0] = "none"; - GroupType2[GroupType2["legend"] = 1] = "legend"; - GroupType2[GroupType2["xAxis"] = 2] = "xAxis"; - GroupType2[GroupType2["yAxis"] = 3] = "yAxis"; - GroupType2[GroupType2["zAxis"] = 4] = "zAxis"; - })(GroupType || (GroupType = {})); - function getAxisGroupType(item, options2) { - const axisItem = item; - const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; - if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options2.zAxisZindex && options2.zAxisZindex !== void 0) { - return GroupType.zAxis; - } - switch (axisItem.orient) { - case "bottom": - case "top": - return GroupType.xAxis; - case "left": - case "right": - return GroupType.yAxis; - } - } - function convertGroupRole(item, options2) { - if (item.mark.role === "legend") - return GroupType.legend; - if (item.mark.role === "axis") { - const groupType = getAxisGroupType(item, options2); - if (groupType !== void 0) { - return groupType; - } - } - } - const group$1 = (options2, stage, scene, x2, y2, groupType) => { - base$3.vega.sceneVisit(scene, function(g) { - const gx = g.x || 0, gy = g.y || 0; - if (g.context && g.context.background && !stage.backgroundColor) { - stage.backgroundColor = colorFromString(g.context.background); - } - if (g.stroke) { - const facetRect = { - datum: g.datum, - lines: box(gx + x2, gy + y2, g.height, g.width, g.stroke, groupStrokeWidth) - }; - stage.facets.push(facetRect); - } - groupType = convertGroupRole(g, options2) || groupType; - setCurrentAxis(options2, stage, groupType); - base$3.vega.sceneVisit(g, function(item) { - mainStager(options2, stage, item, gx + x2, gy + y2, groupType); - }); - }); - }; - function setCurrentAxis(options2, stage, groupType) { - let axisRole; - switch (groupType) { - case GroupType.xAxis: - axisRole = "x"; - break; - case GroupType.yAxis: - axisRole = "y"; - break; - case GroupType.zAxis: - axisRole = "z"; - break; - default: - return; - } - options2.currAxis = { - axisRole, - domain: null, - tickText: [], - ticks: [] - }; - stage.axes[axisRole].push(options2.currAxis); - } - const markStagers = { - group: group$1, - legend: markStager$5, - image: markStager$4, - rect: markStager$3, - rule: markStager$2, - line: markStager$1, - text: markStager - }; - const mainStager = (options2, stage, scene, x2, y2, groupType) => { - if (scene.marktype !== "group" && groupType === GroupType.legend) { - markStager$5(options2, stage, scene); - } else { - const markStager2 = markStagers[scene.marktype]; - if (markStager2) { - markStager2(options2, stage, scene, x2, y2, groupType); - } - } - }; - function sceneToStage(options2, stage, scene) { - mainStager(options2, stage, scene, 0, 0, null); - sortAxis(stage.axes.x, 0); - sortAxis(stage.axes.y, 1); - sortAxis(stage.axes.z, 1); - } - function sortAxis(axes, dim) { - axes.forEach((axis) => { - if (axis.domain) - orderDomain(axis.domain, dim); - axis.ticks.sort((a2, b2) => a2.sourcePosition[dim] - b2.sourcePosition[dim]); - axis.tickText.sort((a2, b2) => a2.position[dim] - b2.position[dim]); - }); - } - function orderDomain(domain2, dim) { - if (domain2.sourcePosition[dim] > domain2.targetPosition[dim]) { - const temp2 = domain2.targetPosition; - domain2.targetPosition = domain2.sourcePosition; - domain2.sourcePosition = temp2; - } - } - function outerBounds(b1, b2) { - if (!b1 && !b2) - return; - if (!b1) - return b2; - if (!b2) - return b1; - const minProps = [ - "minBoundsX", - "minBoundsY", - "minBoundsZ" - ]; - const maxProps = [ - "maxBoundsX", - "maxBoundsY", - "maxBoundsZ" - ]; - const result = {}; - minProps.forEach((p) => result[p] = notNull(Math.min, b1[p], b2[p])); - maxProps.forEach((p) => result[p] = notNull(Math.max, b1[p], b2[p])); - return result; - } - function notNull(fn2, v1, v2) { - if (v1 == null && v2 == null) - return null; - if (v1 == null) - return v2; - if (v2 == null) - return v1; - return fn2(v1, v2); - } - function increment$1(b2, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { - return outerBounds(b2, { - minBoundsX, - minBoundsY, - minBoundsZ, - maxBoundsX, - maxBoundsY, - maxBoundsZ - }); - } - const createAxesLayer = (props) => { - const { config, height: height2, ref: ref2, stage } = props; - const { core } = ref2; - const { renderer } = core; - const { x: x2, y: y2, z: z2 } = stage.axes; - const xyz = [...x2, ...y2, ...z2]; - renderer.currentAxes = []; - if (!xyz.length) { - renderer.axesVisibility = AxesVisibility.none; - return; - } - renderer.axesVisibility = AxesVisibility.current; - const correlation = new AxesCorrelation(stage, 3); - const { axesSets, labels } = correlation; - const grid2 = correlation.getGrid(); - if (grid2.byColumn[0]) { - grid2.byColumn[0].forEach((row) => { - row.axesSet.showFacetTitleY = true; - }); - grid2.byRow[0].forEach((col) => { - col.axesSet.showFacetTitleX = true; - }); - } - if (grid2.rows > 1) { - const { byRow } = grid2; - byRow[0].forEach(({ axesSet }, col) => { - if (!axesSet.y) { - if (byRow[1][col].axesSet) { - byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; - byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; - delete axesSet.x; - } - } - }); - } - let bounds2; - const allAxesSetBounds = []; - let anyZ = false; - for (let i = 0; i < axesSets.length; i++) { - if (axesSets[i].z) { - anyZ = true; - break; - } - } - const is3d = stage.view === "3d" && anyZ; - axesSets.forEach((axesSet) => { - if (!axesSet.x && !axesSet.y) - return; - const axesSetBounds = { - axesSet, - maxBoundsX: null, - maxBoundsY: null, - maxBoundsZ: null, - minBoundsX: null, - minBoundsY: null, - minBoundsZ: null - }; - if (is3d) { - const zBounds = getDomainBounds(1, axesSet.z); - axesSetBounds.minBoundsZ = -zBounds.maxBounds; - axesSetBounds.maxBoundsZ = -zBounds.minBounds; - } - const yBounds = getDomainBounds(1, axesSet.y); - axesSetBounds.minBoundsY = yBounds.minBounds; - axesSetBounds.maxBoundsY = yBounds.maxBounds; - axesSetBounds.y = yBounds.minBounds; - axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; - const xBounds = getDomainBounds(0, axesSet.x); - axesSetBounds.minBoundsX = xBounds.minBounds; - axesSetBounds.maxBoundsX = xBounds.maxBounds; - axesSetBounds.x = xBounds.minBounds; - axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; - allAxesSetBounds.push(axesSetBounds); - bounds2 = outerBounds(bounds2, axesSetBounds); - }); - const facetLabelX = labels.filter((label2) => label2.axisRole === "x")[0]; - const facetLabelY = labels.filter((label2) => label2.axisRole === "y")[0]; - core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { - const axesSet = axesSets[axes]; - let a2; - let f; - switch (axis) { - case 0: { - a2 = axesSet.x; - f = facetLabelX; - break; - } - case 1: { - a2 = axesSet.y; - f = facetLabelY; - break; - } - case 2: { - a2 = axesSet.z; - break; - } - } - if (a2) { - config.onTextClick(manipulator.event, a2.title || f.title); - } - }; - allAxesSetBounds.forEach((axesSetBounds) => { - const { axesSet } = axesSetBounds; - if (!axesSet.x && !axesSet.y) - return; - const cartesian2 = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); - cartesian2.isDivisionPickingEnabled = [false, false, false]; - cartesian2.arePickDivisionsVisible = [false, false, false]; - cartesian2.isLabelPickingEnabled = [false, false, false]; - cartesian2.isTitlePickingEnabled = [false, false, false]; - cartesian2.isGridPickingEnabled = false; - cartesian2.isHeadingPickingEnabled = [false, false, false]; - createAxes(cartesian2, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleX && facetLabelX); - createAxes(cartesian2, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleY && facetLabelY); - if (is3d) { - createAxes(cartesian2, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height2, props); - } - configCartesianAxes(is3d, bounds2, cartesian2); - const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds2; - const w2 = maxBoundsX - minBoundsX; - const h2 = maxBoundsY - minBoundsY; - cartesian2.scalingX = axesSetBounds.w / w2; - cartesian2.scalingY = axesSetBounds.h / h2; - cartesian2.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w2 - 0.5; - cartesian2.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h2 - 0.5; - const aspect = h2 / w2; - if (aspect > 1) { - cartesian2.offsetX /= aspect; - } else { - cartesian2.offsetY *= aspect; - } - const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian2) : renderer.createCartesian2dAxesVisual(cartesian2); - renderer.currentAxes.push(axes); - props.config.onAxesComplete && props.config.onAxesComplete(cartesian2); - }); - return { bounds: bounds2 }; - }; - const nullDomain = { - sourcePosition: [0, 0, 0], - targetPosition: [0, 0, 0] - }; - class AxesCorrelation { - constructor(stage, dimensions) { - this.dimensions = dimensions; - const { x: x2, y: y2, z: z2 } = stage.axes; - this.axesSets = []; - this.labels = []; - [x2, y2, z2].forEach((axes) => { - axes.forEach((axis) => { - if (this.axesSets.length === 0) { - this.initialize(axis); - } else { - this.correlate(axis); - } - }); - }); - } - getGrid() { - const mapCols = {}; - const mapRows = {}; - this.axesSets.forEach((axesSet) => { - var _a2; - const domain2 = (_a2 = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a2 === void 0 ? void 0 : _a2.domain; - if (!domain2) - return; - const col = domain2.sourcePosition[0].toString(); - const row = domain2.sourcePosition[1].toString(); - if (!mapCols[col]) { - mapCols[col] = {}; - } - mapCols[col][row] = axesSet; - mapRows[row] = null; - }); - const colKeys = Object.keys(mapCols).sort((a2, b2) => +a2 - +b2); - const rowKeys = Object.keys(mapRows).sort((a2, b2) => +a2 - +b2); - return { - cols: colKeys.length, - rows: rowKeys.length, - byColumn: colKeys.map((colKey) => rowKeys.map((rowKey) => { - return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; - })), - byRow: rowKeys.map((rowKey) => colKeys.map((colKey) => { - return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; - })) - }; - } - initialize(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - const axesSet = {}; - axesSet[axis.axisRole] = axis; - this.axesSets.push(axesSet); - } - correlate(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - for (let i = 0; i < this.axesSets.length; i++) { - const axesSet = this.axesSets[i]; - for (const axisRole in axesSet) { - const test2 = axesSet[axisRole]; - if (this.matchDomains(axis.domain, test2.domain)) { - if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) { - axesSet[axis.axisRole] = axis; - } - return; - } - } - } - this.initialize(axis); - } - matchDomains(a2, b2) { - if (this.matchPoint(a2.sourcePosition, b2.sourcePosition)) - return true; - if (this.matchPoint(a2.sourcePosition, b2.targetPosition)) - return true; - if (this.matchPoint(a2.targetPosition, b2.targetPosition)) - return true; - if (this.matchPoint(a2.targetPosition, b2.sourcePosition)) - return true; - return false; - } - matchPoint(a2, b2) { - for (let i = 0; i < this.dimensions; i++) { - if (a2[i] !== b2[i]) - return false; - } - return true; - } - } - function createAxes(cartesian2, dim2d, dim3d, axis, orientation, height2, props, facetLabel) { - const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain2, dim2d, height2); - if (axis.axisRole === "z") { - tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); - textPos.forEach((t, i) => textPos[i] = 1 - t); - tickText.reverse(); - tickPositions.reverse(); - textPos.reverse(); - } - cartesian2.setTickPositions(dim3d, tickPositions); - cartesian2.zero[dim3d] = 0; - cartesian2.setLabelPositions(dim3d, textPos); - cartesian2.setLabels(dim3d, tickText); - cartesian2.setLabelSizes(dim3d, textSize); - const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); - if (title === null || title === void 0 ? void 0 : title.text) { - cartesian2.setTitle(dim3d, title.text); - cartesian2.setTitleSize(dim3d, title.size / height2); - } - cartesian2.setLabelOrientation(dim3d, orientation); - props.config.onAxisConfig && props.config.onAxisConfig(cartesian2, dim3d, axis); - return { - tickText - }; - } - function configCartesianAxes(is3d, bounds2, cartesian2) { - if (is3d) { - cartesian2.isEdgeVisible[Edge3D.topBack] = false; - } - cartesian2.isEdgeVisible[Edge3D.backRight] = false; - cartesian2.isEdgeVisible[Edge3D.bottomRight] = false; - cartesian2.isEdgeVisible[Edge3D.frontRight] = false; - cartesian2.isEdgeVisible[Edge3D.topFront] = false; - cartesian2.isEdgeVisible[Edge3D.topRight] = false; - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; - cartesian2.minBoundsX = minBoundsX; - cartesian2.maxBoundsX = maxBoundsX; - cartesian2.minBoundsY = minBoundsY; - cartesian2.maxBoundsY = maxBoundsY; - if (is3d) { - cartesian2.minBoundsZ = minBoundsZ; - cartesian2.maxBoundsZ = maxBoundsZ; - } - } - function getDomainBounds(dim2d, axis) { - const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const minBounds = domain2.sourcePosition[dim2d]; - const maxBounds = domain2.targetPosition[dim2d]; - return { - maxBounds, - minBounds - }; - } - function convertAxis(axis, domain2, dim, height2) { - const start = domain2.sourcePosition[dim]; - const span2 = domain2.targetPosition[dim] - start; - const tickPositions = axis ? axis.ticks.map((t) => (t.sourcePosition[dim] - start) / span2) : []; - const tickText = axis ? axis.tickText.map((t) => t.text) : []; - const textPos = axis ? axis.tickText.map((t) => (t.position[dim] - start) / span2) : []; - const textSize = axis ? axis.tickText.map((t) => t.size / height2) : []; - if (tickPositions.length) { - if (tickPositions[0] !== 0) { - tickPositions[0] = 0; - } - if (tickPositions[tickPositions.length - 1] !== 1) { - tickPositions[tickPositions.length - 1] = 1; - } - } - return { - tickPositions, - tickText, - textPos, - textSize - }; - } - let ColorMap$1 = class ColorMap { - constructor(quant = 5) { - this.quant = quant; - this.colorMap = {}; - this.colorArray = []; - } - getColorKey(rgbaColor) { - const color2 = rgbaColor.slice(0, 3).map((e) => Math.floor(e / this.quant) * this.quant); - color2[3] = rgbaColor[3]; - return JSON.stringify(color2); - } - registerColor(rgbaColor) { - const colorKey = this.getColorKey(rgbaColor); - if (!this.colorMap[colorKey]) { - this.colorMap[colorKey] = { - index: this.colorArray.length, - rgbaColor - }; - this.colorArray.push(rgbaColor); - } - return this.colorMap[colorKey].index; - } - getPalette() { - return { - palette: new Uint8Array(this.colorArray.flat()), - maxColor: this.colorArray.length - 1 - }; - } - }; - function convert$3(newColor) { - const c2 = colorFromString(newColor).slice(0, 3); - return c2.map((v) => v / 255); - } - function colorConfig(ref2, colors2) { - if (!colors2) - return; - const { config } = ref2.core; - config.activeColor = convert$3(colors2.activeItemColor); - config.backgroundColor = new Float32Array(convert$3(colors2.backgroundColor)); - config.textColor = convert$3(colors2.textColor); - config.textBorderColor = convert$3(colors2.textBorderColor); - config.axesTextColor = convert$3(colors2.axesTextLabelColor); - config.axesGridBackgroundColor = convert$3(colors2.axesGridBackgroundColor); - config.axesGridHighlightColor = convert$3(colors2.axesGridHighlightColor); - config.axesGridMinorColor = convert$3(colors2.axesGridMinorColor); - config.axesGridMajorColor = convert$3(colors2.axesGridMajorColor); - config.axesGridZeroColor = convert$3(colors2.axesGridZeroColor); - ref2.core.renderer["_theme"] = null; - } - const key$2 = "cube"; - const createCubeLayer = (props) => { - const { ref: ref2, stage } = props; - const { core } = ref2; - const scatter = new Scatter(core); - const { ids, colors: colors2, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds: bounds2, maxColor, palette } = convert$2(stage); - if (!ids.length) - return; - const { renderer } = core; - let cubeTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$2); - if (!cubeTransitionBuffer) { - cubeTransitionBuffer = renderer.createTransitionBuffer(ids); - cubeTransitionBuffer.key = key$2; - renderer.transitionBuffers.push(cubeTransitionBuffer); - } else { - cubeTransitionBuffer.swap(); - } - scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { - positionsX, - positionsY, - positionsZ - }); - const layer = { - positionsX, - positionsY, - positionsZ, - update: (newBounds, selected, stagger) => { - const { colors: colors3, maxColor: maxColor2, minColor, palette: palette2 } = layer.unitColorMap; - const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$2); - currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; - currCubeTransitionBuffer.currentPalette.colors = palette2; - let options2 = Object.assign({ - selected, - colors: colors3, - minColor, - maxColor: maxColor2, - sizesX, - sizesY, - sizesZ - }, newBounds); - if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { - const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; - options2 = Object.assign(Object.assign({}, options2), { - maxStaggerOrder, - minStaggerOrder, - staggerOrders - }); - } - scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options2); - }, - bounds: bounds2, - unitColorMap: { - colors: colors2, - ids, - minColor: 0, - maxColor, - palette - } - }; - return layer; - }; - function convert$2(stage) { - const { cubeData } = stage; - const { length: length2 } = cubeData; - const ids = []; - const colors2 = new Float64Array(length2); - const positionsX = new Float64Array(length2); - const positionsY = new Float64Array(length2); - const positionsZ = new Float64Array(length2); - const sizesX = new Float64Array(length2); - const sizesY = new Float64Array(length2); - const sizesZ = new Float64Array(length2); - let bounds2; - const colorMap = new ColorMap$1(); - cubeData.forEach((cube, i) => { - ids.push(i); - if (cube.isEmpty) { - positionsX[i] = 0; - positionsY[i] = 0; - positionsZ[i] = 0; - sizesX[i] = 0; - sizesY[i] = 0; - sizesZ[i] = 0; - colors2[i] = 0; - } else { - positionsX[i] = cube.position[0] + cube.size[0] * 0.5; - positionsY[i] = cube.position[1] + cube.size[1] * 0.5; - positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; - sizesX[i] = cube.size[0]; - sizesY[i] = cube.size[1]; - sizesZ[i] = cube.size[2]; - bounds2 = increment$1(bounds2, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); - colors2[i] = colorMap.registerColor(cube.color); - } - }); - const { palette, maxColor } = colorMap.getPalette(); - return { - ids: new Uint32Array(ids), - colors: colors2, - positionsX, - positionsY, - positionsZ, - sizesX, - sizesY, - sizesZ, - bounds: bounds2, - maxColor, - palette - }; - } - const key$1 = "line"; - const createLineLayer = (props) => { - const { height: height2, ref: ref2, stage } = props; - const { core } = ref2; - const lines = new Line(core); - const { ids, fromIds, toIds, lineColors, lineSizes, bounds: bounds2, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert$1(stage, height2); - if (!ids.length) - return; - const { renderer } = core; - let lineTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$1); - if (!lineTransitionBuffer) { - lineTransitionBuffer = renderer.createTransitionBuffer(ids); - lineTransitionBuffer.key = key$1; - renderer.transitionBuffers.push(lineTransitionBuffer); - } else { - lineTransitionBuffer.swap(); - } - lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { - positionsX, - positionsY, - positionsZ, - lineSizes, - sizeScaling: 1 - }); - let options2 = { - lineColors, - lineMinColor: 0, - lineMaxColor - }; - lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; - lineTransitionBuffer.currentPalette.colors = palette; - return { - update: (newBounds) => { - options2 = Object.assign(Object.assign({}, options2), newBounds); - const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$1); - lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options2); - }, - bounds: bounds2, - unitColorMap: { - ids, - colors: lineColors, - minColor: 0, - maxColor: lineMaxColor, - palette - } - }; - }; - function convert$1(stage, height2, width2) { - const { pathData } = stage; - const positions2 = []; - const lines = []; - const colorMap = new ColorMap$1(); - pathData.forEach((path2) => { - const color2 = colorMap.registerColor(path2.strokeColor); - let from = positions2.length; - positions2.push(path2.positions[0]); - for (let i = 1; i < path2.positions.length; i++) { - const to = positions2.length; - positions2.push(path2.positions[i]); - lines.push({ - id: lines.length, - from, - to, - color: color2, - size: path2.strokeWidth - }); - from = to; - } - }); - const ids = new Uint32Array(lines.length); - const fromIds = new Uint32Array(lines.length); - const toIds = new Uint32Array(lines.length); - const lineColors = new Float64Array(lines.length); - const lineSizes = new Float64Array(lines.length); - lines.forEach((line2, i) => { - ids[i] = i; - fromIds[i] = line2.from; - toIds[i] = line2.to; - lineColors[i] = line2.color; - lineSizes[i] = line2.size; - }); - const positionsX = new Float64Array(positions2.length); - const positionsY = new Float64Array(positions2.length); - const positionsZ = new Float64Array(positions2.length); - let bounds2; - positions2.forEach((p, i) => { - positionsX[i] = p[0]; - positionsY[i] = p[1] + height2; - positionsZ[i] = p[2]; - bounds2 = increment$1(bounds2, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); - }); - const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); - return { - ids, - fromIds, - toIds, - lineColors, - lineSizes, - bounds: bounds2, - positionsX, - positionsY, - positionsZ, - lineMaxColor, - palette - }; - } - const createTextLayer = (props) => { - const { ref: ref2, stage } = props; - const { core } = ref2; - const { positionsX, positionsY, positionsZ, sizes, bounds: bounds2, maxGlyphs, text: text2 } = convert(stage); - if (text2.length === 0) { - core.renderer.labelSets = []; - return; - } - const options2 = { - text: text2, - maxGlyphs, - scales: sizes - }; - const labelSet = new LabelSet(core, options2); - labelSet.positionsX = positionsX; - labelSet.positionsY = positionsY; - labelSet.positionsZ = positionsZ; - labelSet.horizontalAlignment = HorizontalAlignment.center; - labelSet.verticalAlignment = VerticalAlignment.center; - const layer = { - update: (bounds3) => { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds3; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - }, - bounds: bounds2 - }; - const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); - core.renderer.labelSets = [labelSetVisual]; - return layer; - }; - function convert(stage) { - const { textData } = stage; - const { length: length2 } = textData; - const ids = []; - const text2 = []; - const colors2 = new Float64Array(length2); - const positionsX = new Float64Array(length2); - const positionsY = new Float64Array(length2); - const positionsZ = new Float64Array(length2); - const sizes = new Float64Array(length2); - let bounds2; - let maxGlyphs = 0; - const colorMap = new ColorMap$1(); - textData.forEach((t, i) => { - ids.push(i); - text2.push(t.text); - maxGlyphs += t.text.length; - positionsX[i] = t.position[0]; - positionsY[i] = t.position[1]; - positionsZ[i] = t.position[2]; - sizes[i] = 1.5 * t.size; - bounds2 = increment$1(bounds2, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); - colors2[i] = colorMap.registerColor(t.color); - }); - const { palette, maxColor } = colorMap.getPalette(); - return { - ids: new Uint32Array(ids), - colors: colors2, - positionsX, - positionsY, - positionsZ, - sizes, - bounds: bounds2, - maxColor, - maxGlyphs, - palette, - text: text2 - }; - } - function getImageData(url) { - return new Promise((resolve2, reject) => { - const imageElement = document.createElement("img"); - imageElement.onload = () => { - const canvas = document.createElement("canvas"); - const ctx = canvas.getContext("2d"); - const { height: height2, width: width2 } = imageElement; - canvas.width = width2; - canvas.height = height2; - ctx.drawImage(imageElement, 0, 0); - resolve2(ctx.getImageData(0, 0, width2, height2)); - }; - imageElement.src = url; - }); - } - function createImageQuad(core, imageData, bounds2, position2, width2, height2) { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; - const imageOptions = { - imageData, - position: position2, - height: height2, - width: width2, - minBoundsX, - maxBoundsX, - minBoundsZ, - maxBoundsZ, - minBoundsY, - maxBoundsY - }; - return new ImageQuad(core, imageOptions); - } - function createCameraDefaults() { - const qModelRotation2d2 = create$4(); - const qModelRotation3d2 = Constants$1.QUAT_ROTATEX_MINUS_90; - const qCameraRotation2d2 = create$4(); - const qCameraRotation3d2 = create$4(); - const qAngle = create$4(); - const vCameraPosition2 = create$6(); - setAxisAngle(qCameraRotation3d2, Constants$1.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); - setAxisAngle(qAngle, Constants$1.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); - multiply(qCameraRotation3d2, qCameraRotation3d2, qAngle); - return { - qModelRotation2d: qModelRotation2d2, - qModelRotation3d: qModelRotation3d2, - qCameraRotation2d: qCameraRotation2d2, - qCameraRotation3d: qCameraRotation3d2, - vCameraPosition: vCameraPosition2 - }; - } - const cameraDefaults = createCameraDefaults(); - const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; - function applyCameraCallbacks(ref2, lastPresenterConfig, lastView, transistion2dOnly) { - const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref2; - ref2.reset = () => { - core.reset(true); - if (lastView === "3d") { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = qCameraRotation3d; - cameraTransitioner.vPosition.to = vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = qCameraRotation2d; - cameraTransitioner.vPosition.to = vCameraPosition; - } - slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); - core.setModelRotation(modelTransitioner.qRotation.current, true); - core.camera.setOrbit(cameraTransitioner.qRotation.to, true); - core.camera.setPosition(cameraTransitioner.vPosition.to, true); - }; - const cam = (t) => { - slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); - lerp$1(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); - core.camera.setOrbit(cameraTransitioner.qRotation.current, false); - core.camera.setPosition(cameraTransitioner.vPosition.current, false); - core.inputManager.isPickingEnabled = false; - }; - core.updateCallback = (elapsedTime) => { - const { transitionDurations } = lastPresenterConfig; - if (positionTransitioner.isTransitioning) { - const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); - core.renderer.transitionTime = t; - setTransitionTimeAxesVisibility(transistion2dOnly, core); - } else { - core.inputManager.isPickingEnabled = true; - } - if (modelTransitioner.isTransitioning) { - const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); - if (modelTransitioner.shouldTransition) { - slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); - core.setModelRotation(modelTransitioner.qRotation.current, false); - } - cam(tm); - } - if (cameraTransitioner.isTransitioning) { - const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); - cam(t); - } - }; - } - function setTransitionTimeAxesVisibility(transistion2dOnly, core) { - const t = core.renderer.transitionTime; - if (transistion2dOnly) { - if (t < 0.5) { - core.renderer.axesVisibility = AxesVisibility.previous; - } else { - core.renderer.axesVisibility = AxesVisibility.current; - } - } else { - if (t <= 0.01) { - core.renderer.axesVisibility = AxesVisibility.previous; - } else if (t >= 0.99) { - core.renderer.axesVisibility = AxesVisibility.current; - } else { - core.renderer.axesVisibility = AxesVisibility.none; - } - } - } - function morphChartsRender(ref2, prevStage, stage, height2, width2, preStage, colors2, config) { - const { qCameraRotation2d: qCameraRotation2d2, qCameraRotation3d: qCameraRotation3d2, qModelRotation2d: qModelRotation2d2, qModelRotation3d: qModelRotation3d2, vCameraPosition: vCameraPosition2 } = cameraDefaults; - const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref2; - let transistion2dOnly = false; - let cameraTo; - let holdCamera; - if (config.camera === "hold") { - holdCamera = true; - } else { - cameraTo = config.camera; - } - if (prevStage && prevStage.view !== stage.view) { - modelTransitioner.shouldTransition = !holdCamera; - if (stage.view === "2d") { - modelTransitioner.qRotation.from = qModelRotation3d2; - modelTransitioner.qRotation.to = qModelRotation2d2; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; - } else { - modelTransitioner.qRotation.from = qModelRotation2d2; - modelTransitioner.qRotation.to = qModelRotation3d2; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; - } - } else { - modelTransitioner.shouldTransition = false; - if (stage.view === "2d") { - transistion2dOnly = true; - modelTransitioner.qRotation.to = qModelRotation2d2; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; - } else { - modelTransitioner.qRotation.to = qModelRotation3d2; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; - } - } - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - if (!prevStage) { - core.setModelRotation(modelTransitioner.qRotation.to, false); - core.camera.setOrbit(cameraTransitioner.qRotation.to, false); - core.camera.setPosition(cameraTransitioner.vPosition.to, false); - } else if (!holdCamera) { - cameraTransitioner.begin(); - } - positionTransitioner.begin(); - if (modelTransitioner.shouldTransition) { - modelTransitioner.begin(); - } - const props = { ref: ref2, stage, height: height2, config }; - const cubeLayer = createCubeLayer(props); - const lineLayer = createLineLayer(props); - const textLayer = createTextLayer(props); - const { backgroundImages } = stage; - let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); - backgroundImages === null || backgroundImages === void 0 ? void 0 : backgroundImages.forEach((backgroundImage) => { - contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); - }); - props.bounds = contentBounds; - core.renderer.previousAxes = core.renderer.currentAxes; - const axesLayer = createAxesLayer(props); - core.config.transitionStaggering = config.transitionDurations.stagger; - core.config.transitionDuration = config.transitionDurations.position; - let bounds2; - if (axesLayer && axesLayer.bounds) { - bounds2 = axesLayer.bounds; - } else { - bounds2 = contentBounds; - } - ref2.setMorphChartsRendererOptions(config.renderer); - if (preStage) { - preStage(stage, cubeLayer); - } - core.renderer.images = []; - if (backgroundImages) { - const addImage = (imageBounds, imageData) => { - const imageWidth2 = imageBounds.maxBoundsX - imageBounds.minBoundsX; - const imageHeight2 = imageBounds.maxBoundsY - imageBounds.minBoundsY; - const position2 = [imageBounds.minBoundsX + imageWidth2 / 2, imageBounds.minBoundsY + imageHeight2 / 2, 0]; - const imageQuad = createImageQuad(core, imageData, contentBounds, position2, imageWidth2, imageHeight2); - const imageVisual = core.renderer.createImageVisual(imageQuad); - core.renderer.images.push(imageVisual); - }; - const imageDataCache = {}; - backgroundImages.forEach((backgroundImage) => { - const imageBounds = convertBounds(backgroundImage.bounds); - const imageData = imageDataCache[backgroundImage.url]; - if (imageData) { - addImage(imageBounds, imageData); - } else { - getImageData(backgroundImage.url).then((imageData2) => { - imageDataCache[backgroundImage.url] = imageData2; - addImage(imageBounds, imageData2); - }); - } - }); - } - layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds2, ref2.layerStagger); - applyCameraCallbacks(ref2, config, stage.view, transistion2dOnly); - core.renderer.transitionTime = 0; - colorConfig(ref2, colors2); - return { - bounds: bounds2, - getCubeLayer: () => cubeLayer, - update: (layerSelection) => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, ref2.layerStagger), - activate: (id2) => core.renderer.transitionBuffers[0].activeId = id2, - moveCamera: (camera) => { - if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - cameraTransitioner.move(camera.position, camera.rotation); - } - }, - setTransitionTimeAxesVisibility: () => { - setTransitionTimeAxesVisibility(transistion2dOnly, core); - } - }; - } - function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, layerStagger) { - const layerItems = [ - { - layer: cubeLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes - }, - { - layer: lineLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines - }, - { - layer: textLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts - } - ]; - layerItems.forEach((layerItem) => { - var _a2; - return (_a2 = layerItem.layer) === null || _a2 === void 0 ? void 0 : _a2.update(bounds2, layerItem.selection, layerItem.stagger); - }); - } - function convertBounds(bounds2) { - if (!bounds2) - return; - return { - minBoundsX: bounds2.x1, - maxBoundsX: bounds2.x2, - minBoundsY: -bounds2.y2, - maxBoundsY: -bounds2.y1, - minBoundsZ: minZ, - maxBoundsZ: minZ - }; - } - function shouldChangeRenderer(prev, next) { - var _a2, _b2; - if (!prev || !next) - return true; - if (prev.advanced !== next.advanced) - return true; - if (!prev.advanced) { - return ((_a2 = prev.basicOptions) === null || _a2 === void 0 ? void 0 : _a2.antialias) != ((_b2 = next.basicOptions) === null || _b2 === void 0 ? void 0 : _b2.antialias); - } - } - function getRenderer(mcRendererOptions, core) { - const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; - const r = advanced ? new Main() : new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); - core.renderer = r; - setRendererOptions(r, mcRendererOptions); - return r; - } - function setRendererOptions(renderer, mcRendererOptions) { - const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; - if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) { - for (const key2 in o) { - renderer.config[key2] = o[key2]; - } - } - } - function rendererEnabled(advanced) { - const r = advanced ? new Main() : new Main$1(); - return r.isSupported; - } - const rightButton = 2; - function listenCanvasEvents(core, options2) { - const { container, pickGridCallback } = options2; - const { inputManager } = core; - if (options2.onLasso) { - inputManager.pickLassoCallback = (result) => { - options2.onLasso(result.ids[0], result.manipulator.event); - }; - } - inputManager.singleTouchAction = (manipulator) => { - if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) { - return SingleTouchAction.rotate; - } else if (manipulator.altKey) { - return SingleTouchAction.lasso; - } else { - return SingleTouchAction.translate; - } - }; - inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { - clearClickTimeout(); - const { altKey, button, shiftKey } = manipulator; - const me = { altKey, shiftKey, button }; - const e = me; - pickGridCallback([divisionX, divisionY, divisionZ], e); - }; - const canvas = container.getElementsByTagName("canvas")[0]; - let pickedId; - const hover2 = (e) => { - if (core.renderer.pickedId !== pickedId) { - pickedId = core.renderer.pickedId; - const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options2.onCubeHover(e, ordinal2); - } - }; - canvas.addEventListener("mousemove", (e) => { - clearClickTimeout(); - if (mousedown) { - options2.onCubeHover(e, null); - } - hover2(e); - }); - canvas.addEventListener("mouseout", hover2); - canvas.addEventListener("mouseover", hover2); - let mousedown; - canvas.addEventListener("mousedown", () => { - mousedown = true; - }); - canvas.addEventListener("mouseup", (e) => { - mousedown = false; - }); - let canvasClickTimeout; - const clearClickTimeout = () => { - clearTimeout(canvasClickTimeout); - canvasClickTimeout = null; - }; - canvas.addEventListener("click", (e) => { - canvasClickTimeout = setTimeout(() => { - options2.onCanvasClick(e); - }, 50); - }); - inputManager.pickItemCallback = ({ manipulator }) => { - clearClickTimeout(); - const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options2.onCubeClick(manipulator.event, ordinal2); - }; - } - function cubicInOut(t) { - return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; - } - function easing(t) { - if (t === 0 || t === 1) - return t; - return cubicInOut(t); - } - class Transitioner { - constructor() { - this.isTransitioning = false; - } - begin() { - this.isTransitioning = true; - this.time = 0; - } - elapse(elapsedTime, totalTime, ease = false) { - this.time += elapsedTime; - if (this.time >= totalTime) { - this.isTransitioning = false; - this.time = totalTime; - this.ended && this.ended(); - } - const t = this.time / totalTime; - return ease ? easing(t) : t; - } - } - class CameraTransitioner extends Transitioner { - constructor() { - super(); - this.qRotation = { - from: create$4(), - to: null, - current: create$4() - }; - this.vPosition = { - from: create$6(), - to: null, - current: create$6() - }; - } - move(position2, rotation2) { - this.begin(); - this.qRotation.to = rotation2; - this.vPosition.to = position2; - } - } - class ModelTransitioner extends Transitioner { - constructor() { - super(); - this.shouldTransition = false; - this.qRotation = { - from: null, - to: null, - current: create$4() - }; - } - } - function init$1(options2, mcRendererOptions) { - const { container } = options2; - const core = new Core({ container }); - getRenderer(mcRendererOptions, core); - listenCanvasEvents(core, options2); - core.config.pickSelectDelay = 50; - const cameraTransitioner = new CameraTransitioner(); - const modelTransitioner = new ModelTransitioner(); - const positionTransitioner = new Transitioner(); - positionTransitioner.ended = () => { - core.renderer.axesVisibility = AxesVisibility.current; - }; - const ref2 = { - supportedRenders: { - advanced: rendererEnabled(true), - basic: rendererEnabled(false) - }, - reset: null, - cameraTransitioner, - modelTransitioner, - positionTransitioner, - core, - setMorphChartsRendererOptions(mcRendererOptions2) { - if (shouldChangeRenderer(ref2.lastMorphChartsRendererOptions, mcRendererOptions2)) { - getRenderer(mcRendererOptions2, core); - listenCanvasEvents(core, options2); - } else { - if (mcRendererOptions2.advanced) { - setRendererOptions(core.renderer, mcRendererOptions2); - } - } - ref2.lastMorphChartsRendererOptions = mcRendererOptions2; - }, - lastMorphChartsRendererOptions: mcRendererOptions, - layerStagger: {} - }; - return ref2; - } - class Presenter { - /** - * Get the previously rendered Stage object. - */ - get stage() { - return this._last.stage; - } - /** - * Get the current View camera type. - */ - get view() { - return this._last.view; - } - /** - * Instantiate a new Presenter. - * @param el Parent HTMLElement to present within. - * @param style Optional PresenterStyle styling options. - */ - constructor(el, style2) { - this.el = el; - this.style = deepMerge(defaultPresenterStyle$1, style2); - initializePanel(this); - this._last = { view: null, height: null, width: null, cubeCount: null, stage: null }; - } - /** - * Cancels any pending animation, calling animationCanceled() on original queue. - */ - animationCancel() { - if (this.animationTimer) { - clearTimeout(this.animationTimer); - this.animationTimer = null; - if (this.logger) { - this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || "handler"}`); - } - if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) { - this.queuedAnimationOptions.animationCanceled.call(null); - } - } - } - /** - * Stops the current animation and queues a new animation. - * @param handler Function to invoke when timeout is complete. - * @param timeout Length of time to wait before invoking the handler. - * @param options Optional QueuedAnimationOptions object. - */ - animationQueue(handler, timeout2, options2) { - if (this.logger) { - this.logger(`queueing animation ${options2 && options2.waitingLabel || "waiting"}...(${timeout2})`); - } - this.animationCancel(); - this.animationTimer = setTimeout(() => { - if (this.logger) { - this.logger(`queueing animation ${options2 && options2.handlerLabel || "handler"}...`); - } - handler(); - }, timeout2); - } - /** - * Retrieve a sub-element of the rendered output. - * @param type PresenterElement type of the HTMLElement to retrieve. - */ - getElement(type2) { - const elements = this.el.getElementsByClassName(className$1(type2, this)); - if (elements && elements.length) { - return elements[0]; - } - } - /** - * Present the Vega Scene, or Stage object using Morphcharts. - * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. - * @param height Height of the rendering area. - * @param width Width of the rendering area. - * @param config Optional presentation configuration object. - */ - present(sceneOrStage, height2, width2, config) { - this.animationCancel(); - const scene = sceneOrStage; - let stage; - const options2 = { - maxOrdinal: 0, - currAxis: null, - defaultCubeColor: this.style.defaultCubeColor, - assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (() => options2.maxOrdinal++), - modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, - zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex - }; - if (scene.marktype) { - stage = createStage(scene.view); - sceneToStage(options2, stage, scene); - } else { - stage = sceneOrStage; - } - const c2 = deepMerge(defaultPresenterConfig, config); - if (!this.morphchartsref) { - this._morphChartsOptions = { - container: this.getElement(PresenterElement$1.gl), - pickGridCallback: c2.axisPickGridCallback, - onCubeHover: (e, ordinal2) => { - c2.onCubeHover(e, { ordinal: ordinal2, color: null, position: null, size: null }); - }, - onCubeClick: (e, ordinal2) => { - c2.onCubeClick(e, { ordinal: ordinal2, color: null, position: null, size: null }); - }, - onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, - onLasso: config === null || config === void 0 ? void 0 : config.onLasso - }; - this.morphchartsref = init$1(this._morphChartsOptions, c2.renderer || defaultPresenterConfig.renderer); - } - let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); - if (options2.maxOrdinal) { - cubeCount = Math.max(cubeCount, options2.maxOrdinal); - const empty = { - isEmpty: true - }; - stage.cubeData = patchCubeArray(cubeCount, empty, stage.cubeData); - } - config.preLayer && config.preLayer(stage); - this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height2, width2, config && config.preStage, config && config.morphChartsColors, c2); - delete stage.cubeData; - delete stage.redraw; - this._last = { - cubeCount, - height: height2, - width: width2, - stage, - view: stage.view - }; - const a2 = getActiveElementInfo(); - mount(LegendView({ legend: stage.legend, onClick: config && config.onLegendClick }), this.getElement(PresenterElement$1.legend)); - setActiveElement(a2); - if (config && config.onPresent) { - config.onPresent(); - } - } - canvasToDataURL() { - return new Promise((resolve2, reject) => { - this.morphchartsref.core.afterRenderCallback = () => { - this.morphchartsref.core.afterRenderCallback = null; - const canvas = this.getElement(PresenterElement$1.gl).getElementsByTagName("canvas")[0]; - const png = canvas.toDataURL("image/png"); - resolve2(png); - }; - }); - } - configColors(mcColors) { - colorConfig(this.morphchartsref, mcColors); - } - /** - * Home the camera to the last initial position. - */ - homeCamera() { - var _a2; - (_a2 = this.morphchartsref) === null || _a2 === void 0 ? void 0 : _a2.reset(); - } - /** - * Show guidelines of rendering height/width and center of OrbitView. - */ - showGuides() { - this.getElement(PresenterElement$1.gl).classList.add("show-center"); - } - finalize() { - this.animationCancel(); - if (this.morphchartsref) - this.morphchartsref.core.stop(); - if (this.el) - this.el.innerHTML = ""; - this._last = null; - this.morphchartsref = null; - this.el = null; - this.logger = null; - this.queuedAnimationOptions = null; - } - } - function _RendererGl(loader2) { - class RendererGlInternal extends base$3.vega.Renderer { - initialize(el, width2, height2, origin) { - this.height = height2; - this.width = width2; - return super.initialize(el, width2, height2, origin); - } - resize(width2, height2, origin) { - super.resize(width2, height2, origin); - this.origin = origin; - this.height = height2; - this.width = width2; - return this; - } - _render(scene, items) { - const scene3d = scene; - scene3d.view = this.getView(); - this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); - return this; - } - } - const instance = new RendererGlInternal(loader2); - return instance; - } - const RendererGl = _RendererGl; - let registered = false; - function _ViewGl(runtime2, config) { - class ViewGlInternal extends base$3.vega.View { - constructor(runtime3, config2 = {}) { - super(runtime3, config2); - this.config = config2; - this.presenter = config2.presenter; - config2.presenterConfig = config2.presenterConfig || {}; - config2.presenterConfig.redraw = () => { - this._redraw = true; - this.run(); - }; - } - renderer(...args) { - if (args && args.length) { - const renderer = args[0]; - if (renderer === "morphcharts" && !registered) { - base$3.vega.renderModule("morphcharts", { handler: base$3.vega.CanvasHandler, renderer: RendererGl }); - registered = true; - } - return super.renderer(renderer); - } else { - return super.renderer(); - } - } - initialize(el) { - if (!this.presenter) { - this.presenter = new Presenter(el); - } - super.initialize(this.presenter.getElement(PresenterElement$1.vegaControls)); - const renderer = this._renderer; - renderer.presenterConfig = this.config.presenterConfig; - renderer.presenter = this.presenter; - renderer.getView = this.config && this.config.getView || (() => this.presenter.view || defaultView$1); - return this; - } - error(e) { - if (this.presenter.logger) { - this.presenter.logger(e); - } - } - } - const instance = new ViewGlInternal(runtime2, config); - return instance; - } - const ViewGl = _ViewGl; - const version$5 = "1.0.6"; - const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - Presenter, - get PresenterElement() { - return PresenterElement$1; - }, - ViewGl, - base: base$3, - controls, - defaults: defaults$1, - types, - use: use$5, - util: util$4, - version: version$5 - }, Symbol.toStringTag, { value: "Module" })); - const { defaultPresenterStyle } = defaults$1; - const defaultViewerOptions$1 = { - colors: { - activeCube: "purple", - defaultCube: colorToString(defaultPresenterStyle.defaultCubeColor), - hoveredCube: colorToString(defaultPresenterStyle.highlightColor), - selectedCube: "yellow", - axisSelectHighlight: colorToString([128, 128, 128, 128]), - axisLine: "#000", - axisText: "#000", - gridLine: "#CCC", - backgroundColor: "#FFF" - }, - language: { - headers: { - chart: "Chart", - details: "Details", - legend: "Legend", - selection: "Select & Filter" - }, - bing: "bing", - newColorMap: "remap color to filtered items", - oldColorMap: "keep same colors", - deselect: "deselect", - exclude: "exclude", - isolate: "isolate", - legendOther: "other", - nextDetail: ">", - previousDetail: "<", - reset: "reset", - colorBinCount: "Color bin count", - colorReverse: "Color reverse", - count: "Count", - percent: "Percent", - sum: "Sum", - scatterPointScale: "Point scale", - FacetMaxBins: "Facet max bins", - FacetVMaxBins: "Cross facet max bins", - XMaxBins: "X axis max bins", - YMaxBins: "Y axis max bins", - XGridSize: "X grid size", - YGridSize: "Y grid size", - InnerPaddingSize: "Inner padding size", - OuterPaddingSize: "Outer padding size", - treeMapMethod: "Treemap layout", - facetColumns: "Facet columns", - facetRows: "Facet rows", - markOpacitySignal: "Mark opacity", - textScaleSignal: "Text scale", - xAxisTextAngleSignal: "X axis text angle", - yAxisTextAngleSignal: "Y axis text angle", - zGrounded: "Z grounded", - zScaleProportion: "Z scale proportion to Y", - selectionCount: (count2) => `${count2} items selected` - }, - maxLegends: 19, - //20 would be "other" - onError: (errors) => { - }, - filterRenderingTimerPadding: 200, - selectionPolygonZ: -1, - tickSize: 10 - }; - function getPresenterStyle(options2) { - const style2 = { - cssPrefix, - fontFamily: options2.fontFamily, - defaultCubeColor: colorFromString(options2.colors.defaultCube) - }; - if (options2.colors.hoveredCube) { - style2.highlightColor = colorFromString(options2.colors.hoveredCube); - } - return style2; - } - const cssPrefix = "sanddance-"; - const dualColorSchemeColors = { - black: "#212121", - gray: "#D2D2D2", - blue: "#0060F0", - green: "#00C000", - orange: "#FF9900", - red: "#E00000" - }; - function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { - if (includeVegaMorphChartsFields) { - if (columnName === GL_ORDINAL) - return true; - } - for (const f in FieldNames) { - if (columnName === FieldNames[f]) - return true; - } - return false; - } - const util$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - getColumnsFromData, - getPresenterStyle, - getStats, - inferAll, - isInternalFieldName - }, Symbol.toStringTag, { value: "Module" })); - const dualPairs = [ - [dualColorSchemeColors.black, dualColorSchemeColors.gray], - [dualColorSchemeColors.red, dualColorSchemeColors.green], - [dualColorSchemeColors.red, dualColorSchemeColors.blue], - [dualColorSchemeColors.black, dualColorSchemeColors.red], - [dualColorSchemeColors.black, dualColorSchemeColors.orange], - [dualColorSchemeColors.black, dualColorSchemeColors.green] - ]; - const colorSchemes = [ - { - scheme: ColorScaleNone, - colors: [defaultViewerOptions$1.colors.defaultCube] - } - ]; - createDualColorSchemes(); - function registerColorSchemes(vega2) { - colorSchemes.forEach((cs) => { - if (cs.colors.length === 1) { - vega2.scheme(cs.scheme, (x2) => cs.colors[0]); - } else { - vega2.scheme(cs.scheme, cs.colors); - } - }); - } - function createPair(names, colors2) { - const scheme2 = `dual_${names[0]}${names[1]}`; - colorSchemes.push({ scheme: scheme2, colors: colors2 }); - } - function createDualColorSchemes() { - dualPairs.forEach((colors2) => { - const names = colors2.map((color2) => { - for (const key2 in dualColorSchemeColors) - if (color2 === dualColorSchemeColors[key2]) - return key2; - }); - createPair(names, colors2); - createPair([...names].reverse(), [...colors2].reverse()); - }); - } - var DataLayoutChange; - (function(DataLayoutChange2) { - DataLayoutChange2[DataLayoutChange2["same"] = 0] = "same"; - DataLayoutChange2[DataLayoutChange2["reset"] = 1] = "reset"; - DataLayoutChange2[DataLayoutChange2["refine"] = 2] = "refine"; - })(DataLayoutChange || (DataLayoutChange = {})); - class Animator { - constructor(dataScope, props) { - this.dataScope = dataScope; - this.props = props; - } - select(search) { - return new Promise((resolve2, reject) => { - this.dataScope.select(search); - this.props.onDataChanged(DataLayoutChange.same); - resolve2(); - }); - } - deselect() { - return new Promise((resolve2, reject) => { - this.dataScope.deselect(); - this.props.onDataChanged(DataLayoutChange.same); - resolve2(); - }); - } - filter(search, keepData, collapseData, rebase) { - if (rebase) { - this.dataScope.collapse(false, keepData); - } - this.dataScope.collapse(true, collapseData); - return new Promise((resolve2, reject) => { - this.props.onAnimateDataChange(DataLayoutChange.refine, "before refine", "refine").then(() => { - this.dataScope.deselect(); - this.dataScope.setFilteredData(keepData); - this.props.onDataChanged(DataLayoutChange.refine, search); - resolve2(); - }).catch(reject); - }); - } - reset() { - return new Promise((resolve2, reject) => { - this.dataScope.deselect(); - let time2; - if (!this.dataScope.hasFilteredData()) { - time2 = 0; - } else { - this.dataScope.setFilteredData(null); - } - this.props.onAnimateDataChange(DataLayoutChange.reset, "before reset", "reset", time2).then(() => { - this.dataScope.collapse(false); - this.props.onDataChanged(DataLayoutChange.reset); - resolve2(); - }).catch(reject); - }); - } - activate(datum2) { - return new Promise((resolve2, reject) => { - this.dataScope.activate(datum2); - this.props.onDataChanged(DataLayoutChange.same); - resolve2(); - }); - } - deactivate() { - return new Promise((resolve2, reject) => { - this.dataScope.deactivate(); - this.props.onDataChanged(DataLayoutChange.same); - resolve2(); - }); - } - } - function notNice(niceValue) { - return (niceValue + "").replace(/[\s,]/g, ""); - } - function tickValue(axis, i) { - const tick = axis.tickText[i]; - let value2; - if (tick) { - value2 = axis.tickText[i].value; - } - return { tick, value: value2 }; - } - function selectNullOrEmpty(column) { - const searchExpression = { - name: column.name, - operator: "isnullorEmpty" - }; - return searchExpression; - } - function selectExact(column, value2) { - if (value2 == null) { - return selectNullOrEmpty(column); - } - const searchExpression = { - name: column.name, - operator: "==", - value: value2 - }; - return searchExpression; - } - function selectNone(column, values2) { - const expressions = values2.map((value2, i) => { - const searchExpression = { - name: column.name, - operator: "!=", - value: value2 - }; - if (i) { - searchExpression.clause = "&&"; - } - return searchExpression; - }); - const searchExpressionGroup = { - expressions - }; - return searchExpressionGroup; - } - function selectExactAxis(axis, column, i) { - const result = tickValue(axis, i); - if (result.tick) { - return selectExact(column, result.value); - } - } - function selectBetween(column, lowValue, highValue, lowOperator = ">=", highOperator = "<") { - const expressions = []; - if (lowValue !== void 0) { - expressions.push({ - name: column.name, - operator: lowOperator, - value: lowValue - }); - } - if (highValue !== void 0) { - expressions.push({ - name: column.name, - operator: highOperator, - value: highValue - }); - } - if (expressions.length > 1) { - expressions[1].clause = "&&"; - } - const searchExpressionGroup = { - expressions - }; - return searchExpressionGroup; - } - function selectBetweenAxis(axis, column, i) { - const low = tickValue(axis, i); - const high = tickValue(axis, i + 1); - return selectBetween(column, low.value, high.value); - } - const dimToRole = { - 0: "x", - 1: "y", - 2: "z" - }; - const roleToDim = { - x: 0, - y: 1, - z: 1 - }; - class AxisSelection { - constructor(specCapabilities, columns, stage) { - this.specCapabilities = specCapabilities; - this.columns = columns; - this.stage = stage; - } - convert(divisions) { - const searchRoles = []; - divisions.forEach((division, i) => { - const role = dimToRole[i]; - const axes = this.stage.axes[role]; - const axis = axes.filter((axis2) => axis2.tickText.length)[0]; - if (axis) { - const capabilities2 = this.specCapabilities.roles.filter((r) => r.role === role)[0]; - const column = this.columns[role]; - if (division >= 0 && (capabilities2 === null || capabilities2 === void 0 ? void 0 : capabilities2.axisSelection)) { - searchRoles.push({ - axis, - role, - capabilities: capabilities2, - column, - division - }); - } - } - }); - switch (searchRoles.length) { - case 0: { - return null; - } - case 1: { - return this.getSearchFromSearchRole(searchRoles[0]); - } - default: { - const roles = searchRoles.map((searchRole) => this.getSearchFromSearchRole(searchRole)); - roles.forEach((role, i) => { - if (i === 0) - return; - role.clause = "&&"; - }); - return roles; - } - } - } - getSearchFromSearchRole(searchRole) { - const getSearch = searchRole.capabilities.axisSelection === "exact" ? (a2, c2, i) => ({ expressions: [selectExactAxis(a2, c2, i)] }) : selectBetweenAxis; - const { axis, column, division } = searchRole; - return getSearch(axis, column, division); - } - } - function moveTicksBetween(axes) { - axes.forEach((axis) => { - if (axis.ticks.length === 0) - return; - const dim = roleToDim[axis.axisRole]; - const { color: color2 } = axis.ticks[0]; - const newLine = (value2) => { - const line2 = { - sourcePosition: [0, 0, 0], - targetPosition: [0, 0, 0], - color: color2 - }; - line2.sourcePosition[dim] = value2; - return line2; - }; - const newTicks = []; - newTicks.push(newLine(axis.domain.sourcePosition[dim])); - for (let i = 1; i < axis.ticks.length; i++) { - newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); - } - newTicks.push(newLine(axis.domain.targetPosition[dim])); - axis.ticks = newTicks; - }); - } - function populateColorContext(colorContext, presenter) { - if (!colorContext.colorMap) { - colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; - } - colorContext.legend = clone(presenter.stage.legend); - colorContext.legendElement = presenter.getElement(PresenterElement$1.legend).children[0]; - } - let DataScope$2 = class DataScope { - constructor() { - this.filteredColumnsStats = {}; - } - setData(data2, columns) { - const differentData = this.data !== data2; - if (differentData) { - if (this.data) { - this.deselect(); - } - this.data = data2; - this.columns = columns; - this.filteredData = null; - this.filteredColumnsStats = {}; - } - return differentData; - } - setFilteredData(filteredData) { - this.filteredData = filteredData; - this.filteredColumnsStats = {}; - } - getColumns(columnTypes) { - if (!this.columns) { - this.columns = getColumnsFromData(base$3.vega.inferTypes, this.data, columnTypes); - } - return this.columns; - } - getFilteredColumnStats(columnName) { - if (!this.filteredColumnsStats[columnName]) { - this.filteredColumnsStats[columnName] = getStats(this.filteredData, this.columns.filter((c2) => c2.name === columnName)[0]); - } - return this.filteredColumnsStats[columnName]; - } - currentData() { - return this.filteredData || this.data; - } - select(search) { - this.deselect(); - if (search) { - this.selection = this.createUserSelection(search, true, false); - if (this.selection.included.length) { - this.activate(this.selection.included[0]); - } - } - } - createUserSelection(search, assign2, rebase) { - const exec = new Exec(search, this.getColumns()); - const s2 = { - search, - included: [], - excluded: [] - }; - const data2 = rebase ? this.data : this.currentData(); - data2.forEach((datum2) => { - if (exec.run(datum2)) { - if (assign2) { - datum2[FieldNames.Selected] = true; - } - s2.included.push(datum2); - } else { - s2.excluded.push(datum2); - } - }); - return s2; - } - deselect() { - this.deactivate(); - this.data.forEach((datum2) => { - delete datum2[FieldNames.Selected]; - }); - this.selection = null; - } - hasFilteredData() { - return !!this.filteredData; - } - hasSelectedData() { - return !!this.selection; - } - collapse(collapsed, data2 = this.data) { - data2.forEach((datum2) => { - datum2[FieldNames.Collapsed] = collapsed; - }); - this.isCollapsed = collapsed; - } - activate(datum2) { - this.deactivate(); - datum2[FieldNames.Active] = true; - this.active = datum2; - } - deactivate() { - if (this.active) { - delete this.active[FieldNames.Active]; - } - this.active = null; - } - ordinalIndexWithinSelection(ordinal2) { - if (this.selection) { - for (let i = 0; i < this.selection.included.length; i++) { - const datum2 = this.selection.included[i]; - if (datum2[GL_ORDINAL] === ordinal2) { - return { datum: datum2, index: i }; - } - } - } - return { datum: null, index: -1 }; - } - finalize() { - this.data = null; - this.filteredData = null; - this.filteredColumnsStats = null; - if (this.selection) { - this.selection.excluded = null; - this.selection.included = null; - this.selection = null; - } - } - }; - var Action; - (function(Action2) { - Action2[Action2["deselect"] = 0] = "deselect"; - Action2[Action2["isolate"] = 1] = "isolate"; - Action2[Action2["exclude"] = 2] = "exclude"; - Action2[Action2["reset"] = 3] = "reset"; - Action2[Action2["next"] = 4] = "next"; - Action2[Action2["previous"] = 5] = "previous"; - })(Action || (Action = {})); - class Details { - constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps) { - this.language = language; - this.animator = animator; - this.dataScope = dataScope; - this.colorMapHandler = colorMapHandler; - this.hasColorMaps = hasColorMaps; - this.element = addDiv(parentElement, `${cssPrefix}unitControls`); - this.clear(); - } - finalize() { - if (this.element) - this.element.innerHTML = ""; - this.dataScope = null; - this.element = null; - } - clear() { - this.state = { - userSelection: null, - index: -1, - remapColor: false - }; - this.render(); - } - clearSelection() { - this.state.userSelection = null; - this.state.index = -1; - this.render(); - } - populate(userSelection, index2 = 0) { - this.state.userSelection = userSelection; - this.state.index = index2; - this.render(); - } - selectByNameValue(columnName, value2) { - const search = { - name: columnName, - operator: "==", - value: value2 - }; - this.clearSelection(); - this.animator.select(search); - this.populate(this.dataScope.selection); - } - remapChanged(remap) { - this.state.remapColor = remap; - this.colorMapHandler(remap); - this.render(); - } - handleAction(action) { - let p; - const u2 = this.state.userSelection; - switch (action) { - case Action.deselect: { - this.clearSelection(); - p = this.animator.deselect(); - break; - } - case Action.exclude: { - this.clearSelection(); - p = this.animator.filter(invert$2(u2.search), u2.excluded, u2.included, false); - this.state.remapColor = false; - break; - } - case Action.isolate: { - this.clearSelection(); - p = this.animator.filter(u2.search, u2.included, u2.excluded, false); - this.state.remapColor = false; - break; - } - case Action.reset: { - this.clear(); - p = this.animator.reset(); - break; - } - default: { - switch (action) { - case Action.previous: { - this.state.index--; - if (this.state.index < 0) { - this.state.index = this.state.userSelection.included.length - 1; - } - break; - } - case Action.next: { - this.state.index++; - if (this.state.index >= this.state.userSelection.included.length) { - this.state.index = 0; - } - break; - } - } - this.render(); - p = this.animator.activate(this.state.userSelection.included[this.state.index]); - } - } - p.then(() => this.render()); - } - render() { - const hasRefinedData = this.dataScope.hasFilteredData(); - const renderProps = { - language: this.language, - actionHandler: (action) => this.handleAction(action), - selectionHandler: (columnName, value2) => this.selectByNameValue(columnName, value2), - count: this.state.userSelection && this.state.userSelection.included.length, - hasRefinedData, - item: this.state.userSelection && this.state.userSelection.included[this.state.index], - remapColorHandler: (remap) => this.remapChanged(remap), - hasColorMaps: this.hasColorMaps() && hasRefinedData, - remapColor: this.state.remapColor - }; - const a2 = getActiveElementInfo(); - mount(renderDetails(renderProps), this.element); - setActiveElement(a2); - } - } - const renderDetails = (props) => { - const controlButtons = [ - createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.deselect) }, props.language.deselect), - createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.isolate) }, props.language.isolate), - createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.exclude) }, props.language.exclude) - ]; - const colorMapping2 = createElement( - "div", - null, - createElement("button", { disabled: props.remapColor, onClick: (e) => props.remapColorHandler(true) }, props.language.newColorMap), - createElement("button", { disabled: !props.remapColor, onClick: (e) => props.remapColorHandler(false) }, props.language.oldColorMap) - ); - const singleItem = props.count === 1; - const scrollButtons = [ - createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.previous) }, props.language.previousDetail), - createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.next) }, props.language.nextDetail), - createElement( - "span", - null, - " ", - props.language.selectionCount(props.count) - ) - ]; - const rows = []; - for (const prop in props.item) { - if (prop === GL_ORDINAL) { - continue; - } - if (isInternalFieldName(prop)) { - continue; - } - rows.push({ - cells: [ - { content: prop }, - { content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) } - ] - }); - } - return createElement( - "div", - null, - props.hasColorMaps && colorMapping2, - createElement("h4", null, props.language.headers.selection), - createElement( - "div", - { className: `${cssPrefix}selection` }, - controlButtons, - createElement("button", { disabled: !props.hasRefinedData, onClick: (e) => props.actionHandler(Action.reset) }, "reset") - ), - props.item && createElement("h4", null, props.language.headers.details), - createElement( - "div", - null, - createElement("div", { className: `${cssPrefix}details-scroll` }, props.item && scrollButtons), - createElement("div", { className: `${cssPrefix}details` }, props.item && createElement(Table$1, { rows })) - ) - ); - }; - function linkSelect(language, columnName, value2, selectionHandler) { - return createElement( - "span", - null, - createElement("a", { href: "#", onClick: (e) => selectionHandler(columnName, value2) }, value2), - isNaN(value2) ? [" ", createElement("a", { className: "bing-search", href: `https://www.bing.com/search?q=${encodeURIComponent(value2)}`, target: "_blank" }, language.bing)] : "" - ); - } - function ensureHeaders(presenter, headers) { - const vegaControls = presenter.getElement(PresenterElement$1.vegaControls); - conditionalHeader(!!vegaControls.querySelectorAll(".vega-bindings > *").length, vegaControls, headers.chart); - const legend2 = presenter.getElement(PresenterElement$1.legend); - conditionalHeader(!!legend2.children.length, legend2, headers.legend); - } - function conditionalHeader(condition, element2, header) { - const existing = existingHeader(element2, header); - if (condition && !existing) { - addHeader(element2, header); - } - if (!condition && existing) { - existing.remove(); - } - } - function addHeader(element2, header) { - const h2 = document.createElement("h4"); - h2.innerHTML = header; - element2.insertAdjacentElement("beforebegin", h2); - } - function existingHeader(element2, header) { - const { previousElementSibling } = element2; - if (previousElementSibling && previousElementSibling.innerHTML === header) { - return previousElementSibling; - } - } - function legendRange(colorBinType, column, legend2, clickedIndex) { - if (column.quantitative) { - return selectQuantitative(colorBinType, column, legend2, clickedIndex); - } else { - return selectCategorical(column, legend2, clickedIndex); - } - } - function selectCategorical(column, legend2, clickedIndex) { - const value2 = legend2.rows[clickedIndex].value; - if (value2 === Other) { - const values2 = []; - for (const i in legend2.rows) { - if (+i !== clickedIndex) { - values2.push(legend2.rows[i].value); - } - } - return selectNone(column, values2); - } else { - return { expressions: [selectExact(column, legend2.rows[clickedIndex].value)] }; - } - } - function selectQuantitative(colorBinType, column, legend2, clickedIndex) { - const keys2 = Object.keys(legend2.rows).map((key2) => +key2).sort((a2, b2) => +a2 - +b2); - let lowValue; - let lowOperator; - let highValue; - let highOperator; - const rowText = legend2.rows[clickedIndex].label; - switch (colorBinType) { - case "continuous": { - lowValue = rowText; - if (clickedIndex < keys2.length - 1) { - highValue = legend2.rows[clickedIndex + 1].value; - } - break; - } - default: { - if (rowText.indexOf("null") > 0) { - const ex = { - expressions: [selectNullOrEmpty(column)] - }; - return ex; - } - const dash = rowText.indexOf("–"); - if (dash > 0) { - lowValue = rowText.substr(0, dash); - highValue = rowText.substr(dash + 1); - } else { - if (rowText.indexOf("<") >= 0) { - highValue = rowText.substring(2); - } else { - if (rowText.indexOf("≥") >= 0) { - lowValue = rowText.substring(2); - } - } - } - } - } - if (lowValue) - lowValue = notNice(lowValue); - if (highValue) - highValue = notNice(highValue); - if (lowValue === highValue) { - return { expressions: [selectExact(column, lowValue)] }; - } else { - return selectBetween(column, lowValue, highValue, lowOperator, highOperator); - } - } - function finalizeLegend(colorBinType, colorColumn, legend2, language) { - const rowTexts = []; - for (const i in legend2.rows) { - const row = legend2.rows[i]; - row.search = legendRange(colorBinType, colorColumn, legend2, +i); - if (row.value === Other) { - row.label = language.legendOther; - } else { - rowTexts.push(row.value); - } - } - } - function assignOrdinals(columns, data2, ordinalMap) { - const uCol = columns.uid && columns.uid.name; - if (ordinalMap) { - data2.forEach((d2, i) => { - const key2 = uCol ? d2[uCol] : i; - d2[GL_ORDINAL] = ordinalMap[key2]; - }); - } else { - ordinalMap = {}; - data2.forEach((d2, i) => { - d2[GL_ORDINAL] = i; - const uColValue = uCol ? d2[uCol] : i; - ordinalMap[uColValue] = i; - }); - } - return ordinalMap; - } - function getDataIndexOfCube(cube, data2) { - const len2 = data2.length; - for (let i = 0; i < len2; i++) { - if (data2[i][GL_ORDINAL] === cube.ordinal) { - return i; - } - } - } - const { push } = util$4; - function getSearchGroupFromVegaValue(search) { - let group2; - const vegaSearch = search; - if (Array.isArray(vegaSearch)) { - group2 = { expressions: [] }; - vegaSearch.forEach((g) => { - const clonedExpressions = clone(g.expressions).filter(Boolean); - clonedExpressions[0].clause = "&&"; - push(group2.expressions, clonedExpressions); - }); - } else { - group2 = vegaSearch ? { expressions: vegaSearch.expressions.filter(Boolean) } : null; - } - return group2; - } - function applySignalValues(sv, b2) { - if (!sv || !b2 || !b2.signals || !b2.signals.length) - return; - for (const key2 in sv) { - const value2 = sv[key2]; - const signalB = b2.signals.filter((signal) => signal.name === key2)[0]; - if (signalB && signalB.bind) { - signalB.value = value2; - } - } - } - function extractSignalValuesFromView(view, spec) { - if (!view || !spec || !spec.signals || !spec.signals.length) - return; - const result = {}; - spec.signals.forEach((signalA) => { - if (signalA.bind) { - try { - result[signalA.name] = view.signal(signalA.name); - } catch (e) { - } - } - }); - return result; - } - const hideSignalUI = [ - SignalNames.MarkOpacity, - SignalNames.TextAngleX, - SignalNames.TextAngleY - ]; - function unbindSignalUI(spec) { - spec.signals.forEach((signal) => { - if (hideSignalUI.indexOf(signal.name) >= 0) { - delete signal.bind; - } - }); - } - const { outerSize } = util$4; - const { Table } = controls; - let Tooltip$1 = class Tooltip { - constructor(props) { - this.props = props; - const renderProps = { - cssPrefix: props.cssPrefix, - rows: getRows(props.dataItem) - }; - this.finalizeHandler = () => this.destroy(); - this.element = renderTooltip(renderProps); - if (this.element) { - this.element.style.position = "absolute"; - this.child = this.element.firstChild; - document.body.appendChild(this.element); - let m2 = outerSize(this.child); - while (m2.height > document.documentElement.clientHeight) { - const tr2 = this.child.querySelector("tr:last-child"); - if (tr2) { - tr2.parentElement.removeChild(tr2); - } else { - break; - } - m2 = outerSize(this.child); - } - let position2; - const te = props.event; - if (te.touches) { - position2 = te[0]; - } else { - const pme = props.event; - position2 = pme; - } - if (position2.clientX + m2.width >= document.documentElement.clientWidth) { - this.child.style.right = "0"; - } - let moveTop = true; - if (position2.clientY + m2.height >= document.documentElement.clientHeight) { - if (position2.clientY - m2.height > 0) { - this.child.style.bottom = "0"; - } else { - moveTop = false; - } - } - if (moveTop) { - this.element.style.top = `${position2.clientY}px`; - } - this.element.style.left = `${position2.clientX}px`; - this.child.addEventListener("mouseenter", this.finalizeHandler); - this.child.addEventListener("mousemove", this.finalizeHandler); - this.child.addEventListener("mouseover", this.finalizeHandler); - } - } - destroy() { - this.child.removeEventListener("mouseenter", this.finalizeHandler); - this.child.removeEventListener("mousemove", this.finalizeHandler); - this.child.removeEventListener("mouseover", this.finalizeHandler); - if (this.element) { - document.body.removeChild(this.element); - } - this.element = null; - } - }; - function cleanDataItem(item) { - const ret = {}; - for (const columnName in item) { - if (columnName === GL_ORDINAL) { - continue; - } - if (isInternalFieldName(columnName)) { - continue; - } - ret[columnName] = item[columnName]; - } - return ret; - } - function getRows(item) { - const rows = []; - for (const columnName in item) { - const value2 = item[columnName]; - let content2; - switch (value2) { - case null: - content2 = createElement("i", null, "null"); - break; - case void 0: - content2 = createElement("i", null, "undefined"); - break; - default: - content2 = value2.toString(); - } - rows.push({ - cells: [ - { content: columnName + ":" }, - { content: content2 } - ] - }); - } - return rows; - } - const renderTooltip = (props) => { - return props.rows.length === 0 ? null : createElement("div", { className: `${props.cssPrefix}tooltip` }, Table({ rows: props.rows })); - }; - class CharacterSet { - resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { - if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) { - this.chars = void 0; - } - } - getCharacterSet(stage) { - if (!this.chars) { - const map2 = {}; - const addText = (text2) => { - Array.from(text2).forEach((char) => { - map2[char] = true; - }); - }; - stage.textData.forEach((t) => addText(t.text)); - const { x: x2, y: y2 } = stage.axes; - [x2, y2].forEach((axes) => { - axes.forEach((axis) => { - if (axis.tickText) - axis.tickText.forEach((t) => addText(t.text)); - if (axis.title) - addText(axis.title.text); - }); - }); - this.chars = Object.keys(map2); - } - return this.chars; - } - } - function needsNewCharacterSet(oldInsight, newInsight) { - if (!oldInsight) - return true; - if (!newInsight) - return true; - if (oldInsight.chart !== newInsight.chart) - return true; - if (oldInsight.facetStyle !== newInsight.facetStyle) - return true; - if (oldInsight.totalStyle !== newInsight.totalStyle) - return true; - if (oldInsight.hideAxes !== newInsight.hideAxes) - return true; - if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) - return true; - if (differentObjectValues(oldInsight.size, newInsight.size)) - return true; - const oldColumns = oldInsight.columns; - const newColumns = newInsight.columns; - if (oldColumns.facet !== newColumns.facet) - return true; - if (oldColumns.facetV !== newColumns.facetV) - return true; - if (oldColumns.x !== newColumns.x) - return true; - if (oldColumns.y !== newColumns.y) - return true; - if (oldColumns.z !== newColumns.z) - return true; - return false; - } - function differentObjectValues(a2, b2) { - if (!a2 && !b2) - return false; - if (!a2 || !b2) - return true; - const keys2 = Object.keys(b2); - for (let i = 0; i < keys2.length; i++) { - const key2 = keys2[i]; - const ta = typeof a2; - const tb = typeof b2; - if (ta !== tb) - return true; - if (ta === "object") { - return differentObjectValues(a2[key2], b2[key2]); - } else { - if (a2[key2] !== b2[key2]) - return true; - } - } - return false; - } - function ascending$2(a2, b2) { - return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN; - } - function descending$1(a2, b2) { - return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN; - } - function bisector(f) { - let compare12, compare2, delta; - if (f.length !== 2) { - compare12 = ascending$2; - compare2 = (d2, x2) => ascending$2(f(d2), x2); - delta = (d2, x2) => f(d2) - x2; - } else { - compare12 = f === ascending$2 || f === descending$1 ? f : zero$3; - compare2 = f; - delta = f; - } - function left(a2, x2, lo = 0, hi = a2.length) { - if (lo < hi) { - if (compare12(x2, x2) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a2[mid], x2) < 0) lo = mid + 1; - else hi = mid; - } while (lo < hi); - } - return lo; - } - function right(a2, x2, lo = 0, hi = a2.length) { - if (lo < hi) { - if (compare12(x2, x2) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a2[mid], x2) <= 0) lo = mid + 1; - else hi = mid; - } while (lo < hi); - } - return lo; - } - function center(a2, x2, lo = 0, hi = a2.length) { - const i = left(a2, x2, lo, hi - 1); - return i > lo && delta(a2[i - 1], x2) > -delta(a2[i], x2) ? i - 1 : i; - } - return { left, center, right }; - } - function zero$3() { - return 0; - } - function number$6(x2) { - return x2 === null ? NaN : +x2; - } - function* numbers$2(values2, valueof) { - if (valueof === void 0) { - for (let value2 of values2) { - if (value2 != null && (value2 = +value2) >= value2) { - yield value2; - } - } - } else { - let index2 = -1; - for (let value2 of values2) { - if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { - yield value2; - } - } - } - } - const ascendingBisect = bisector(ascending$2); - const bisectRight$1 = ascendingBisect.right; - const bisectLeft$1 = ascendingBisect.left; - bisector(number$6).center; - function variance(values2, valueof) { - let count2 = 0; - let delta; - let mean2 = 0; - let sum2 = 0; - if (valueof === void 0) { - for (let value2 of values2) { - if (value2 != null && (value2 = +value2) >= value2) { - delta = value2 - mean2; - mean2 += delta / ++count2; - sum2 += delta * (value2 - mean2); - } - } - } else { - let index2 = -1; - for (let value2 of values2) { - if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { - delta = value2 - mean2; - mean2 += delta / ++count2; - sum2 += delta * (value2 - mean2); - } - } - } - if (count2 > 1) return sum2 / (count2 - 1); - } - function deviation(values2, valueof) { - const v = variance(values2, valueof); - return v ? Math.sqrt(v) : v; - } - class Adder { - constructor() { - this._partials = new Float64Array(32); - this._n = 0; - } - add(x2) { - const p = this._partials; - let i = 0; - for (let j = 0; j < this._n && j < 32; j++) { - const y2 = p[j], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2); - if (lo) p[i++] = lo; - x2 = hi; - } - p[i] = x2; - this._n = i + 1; - return this; - } - valueOf() { - const p = this._partials; - let n = this._n, x2, y2, lo, hi = 0; - if (n > 0) { - hi = p[--n]; - while (n > 0) { - x2 = hi; - y2 = p[--n]; - hi = x2 + y2; - lo = y2 - (hi - x2); - if (lo) break; - } - if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { - y2 = lo * 2; - x2 = hi + y2; - if (y2 == x2 - hi) hi = x2; - } - } - return hi; - } - } - class InternMap extends Map { - constructor(entries, key2 = keyof) { - super(); - Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); - if (entries != null) for (const [key3, value2] of entries) this.set(key3, value2); - } - get(key2) { - return super.get(intern_get(this, key2)); - } - has(key2) { - return super.has(intern_get(this, key2)); - } - set(key2, value2) { - return super.set(intern_set(this, key2), value2); - } - delete(key2) { - return super.delete(intern_delete(this, key2)); - } - } - class InternSet extends Set { - constructor(values2, key2 = keyof) { - super(); - Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); - if (values2 != null) for (const value2 of values2) this.add(value2); - } - has(value2) { - return super.has(intern_get(this, value2)); - } - add(value2) { - return super.add(intern_set(this, value2)); - } - delete(value2) { - return super.delete(intern_delete(this, value2)); - } - } - function intern_get({ _intern, _key }, value2) { - const key2 = _key(value2); - return _intern.has(key2) ? _intern.get(key2) : value2; - } - function intern_set({ _intern, _key }, value2) { - const key2 = _key(value2); - if (_intern.has(key2)) return _intern.get(key2); - _intern.set(key2, value2); - return value2; - } - function intern_delete({ _intern, _key }, value2) { - const key2 = _key(value2); - if (_intern.has(key2)) { - value2 = _intern.get(key2); - _intern.delete(key2); - } - return value2; - } - function keyof(value2) { - return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2; - } - function permute(source2, keys2) { - return Array.from(keys2, (key2) => source2[key2]); - } - function compareDefined(compare2 = ascending$2) { - if (compare2 === ascending$2) return ascendingDefined; - if (typeof compare2 !== "function") throw new TypeError("compare is not a function"); - return (a2, b2) => { - const x2 = compare2(a2, b2); - if (x2 || x2 === 0) return x2; - return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0); - }; - } - function ascendingDefined(a2, b2) { - return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0); - } - const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); - function tickSpec(start, stop2, count2) { - const step = (stop2 - start) / Math.max(0, count2), power = Math.floor(Math.log10(step)), error2 = step / Math.pow(10, power), factor = error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1; - let i1, i2, inc; - if (power < 0) { - inc = Math.pow(10, -power) / factor; - i1 = Math.round(start * inc); - i2 = Math.round(stop2 * inc); - if (i1 / inc < start) ++i1; - if (i2 / inc > stop2) --i2; - inc = -inc; - } else { - inc = Math.pow(10, power) * factor; - i1 = Math.round(start / inc); - i2 = Math.round(stop2 / inc); - if (i1 * inc < start) ++i1; - if (i2 * inc > stop2) --i2; - } - if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start, stop2, count2 * 2); - return [i1, i2, inc]; - } - function ticks(start, stop2, count2) { - stop2 = +stop2, start = +start, count2 = +count2; - if (!(count2 > 0)) return []; - if (start === stop2) return [start]; - const reverse2 = stop2 < start, [i1, i2, inc] = reverse2 ? tickSpec(stop2, start, count2) : tickSpec(start, stop2, count2); - if (!(i2 >= i1)) return []; - const n = i2 - i1 + 1, ticks2 = new Array(n); - if (reverse2) { - if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc; - else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc; - } else { - if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc; - else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc; - } - return ticks2; - } - function tickIncrement(start, stop2, count2) { - stop2 = +stop2, start = +start, count2 = +count2; - return tickSpec(start, stop2, count2)[2]; - } - function tickStep(start, stop2, count2) { - stop2 = +stop2, start = +start, count2 = +count2; - const reverse2 = stop2 < start, inc = reverse2 ? tickIncrement(stop2, start, count2) : tickIncrement(start, stop2, count2); - return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); - } - function max$2(values2, valueof) { - let max2; - if (valueof === void 0) { - for (const value2 of values2) { - if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { - max2 = value2; - } - } - } else { - let index2 = -1; - for (let value2 of values2) { - if ((value2 = valueof(value2, ++index2, values2)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { - max2 = value2; - } - } - } - return max2; - } - function min$2(values2, valueof) { - let min2; - if (valueof === void 0) { - for (const value2 of values2) { - if (value2 != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { - min2 = value2; - } - } - } else { - let index2 = -1; - for (let value2 of values2) { - if ((value2 = valueof(value2, ++index2, values2)) != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { - min2 = value2; - } - } - } - return min2; - } - function quickselect(array2, k, left = 0, right = Infinity, compare2) { - k = Math.floor(k); - left = Math.floor(Math.max(0, left)); - right = Math.floor(Math.min(array2.length - 1, right)); - if (!(left <= k && k <= right)) return array2; - compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2); - while (right > left) { - if (right - left > 600) { - const n = right - left + 1; - const m2 = k - left + 1; - const z2 = Math.log(n); - const s2 = 0.5 * Math.exp(2 * z2 / 3); - const sd = 0.5 * Math.sqrt(z2 * s2 * (n - s2) / n) * (m2 - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m2 * s2 / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m2) * s2 / n + sd)); - quickselect(array2, k, newLeft, newRight, compare2); - } - const t = array2[k]; - let i = left; - let j = right; - swap$1(array2, left, k); - if (compare2(array2[right], t) > 0) swap$1(array2, left, right); - while (i < j) { - swap$1(array2, i, j), ++i, --j; - while (compare2(array2[i], t) < 0) ++i; - while (compare2(array2[j], t) > 0) --j; - } - if (compare2(array2[left], t) === 0) swap$1(array2, left, j); - else ++j, swap$1(array2, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array2; - } - function swap$1(array2, i, j) { - const t = array2[i]; - array2[i] = array2[j]; - array2[j] = t; - } - function quantile$1(values2, p, valueof) { - values2 = Float64Array.from(numbers$2(values2, valueof)); - if (!(n = values2.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return min$2(values2); - if (p >= 1) return max$2(values2); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$2(quickselect(values2, i0).subarray(0, i0 + 1)), value1 = min$2(values2.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); - } - function quantileSorted(values2, p, valueof = number$6) { - if (!(n = values2.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return +valueof(values2[0], 0, values2); - if (p >= 1) return +valueof(values2[n - 1], n - 1, values2); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values2[i0], i0, values2), value1 = +valueof(values2[i0 + 1], i0 + 1, values2); - return value0 + (value1 - value0) * (i - i0); - } - function mean(values2, valueof) { - let count2 = 0; - let sum2 = 0; - if (valueof === void 0) { - for (let value2 of values2) { - if (value2 != null && (value2 = +value2) >= value2) { - ++count2, sum2 += value2; - } - } - } else { - let index2 = -1; - for (let value2 of values2) { - if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { - ++count2, sum2 += value2; - } - } - } - if (count2) return sum2 / count2; - } - function median(values2, valueof) { - return quantile$1(values2, 0.5, valueof); - } - function* flatten(arrays) { - for (const array2 of arrays) { - yield* array2; - } - } - function merge$4(arrays) { - return Array.from(flatten(arrays)); - } - function range$3(start, stop2, step) { - start = +start, stop2 = +stop2, step = (n = arguments.length) < 2 ? (stop2 = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, n = Math.max(0, Math.ceil((stop2 - start) / step)) | 0, range2 = new Array(n); - while (++i < n) { - range2[i] = start + i * step; - } - return range2; - } - function sum$1(values2, valueof) { - let sum2 = 0; - { - for (let value2 of values2) { - if (value2 = +value2) { - sum2 += value2; - } - } - } - return sum2; - } - function intersection(values2, ...others) { - values2 = new InternSet(values2); - others = others.map(set$4); - out: for (const value2 of values2) { - for (const other of others) { - if (!other.has(value2)) { - values2.delete(value2); - continue out; - } - } - } - return values2; - } - function set$4(values2) { - return values2 instanceof InternSet ? values2 : new InternSet(values2); - } - function union(...others) { - const set2 = new InternSet(); - for (const other of others) { - for (const o of other) { - set2.add(o); - } - } - return set2; - } - function initRange(domain2, range2) { - switch (arguments.length) { - case 0: - break; - case 1: - this.range(domain2); - break; - default: - this.range(range2).domain(domain2); - break; - } - return this; - } - function initInterpolator(domain2, interpolator) { - switch (arguments.length) { - case 0: - break; - case 1: { - if (typeof domain2 === "function") this.interpolator(domain2); - else this.range(domain2); - break; - } - default: { - this.domain(domain2); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; - } - } - return this; - } - const implicit = Symbol("implicit"); - function ordinal() { - var index2 = new InternMap(), domain2 = [], range2 = [], unknown = implicit; - function scale2(d2) { - let i = index2.get(d2); - if (i === void 0) { - if (unknown !== implicit) return unknown; - index2.set(d2, i = domain2.push(d2) - 1); - } - return range2[i % range2.length]; - } - scale2.domain = function(_) { - if (!arguments.length) return domain2.slice(); - domain2 = [], index2 = new InternMap(); - for (const value2 of _) { - if (index2.has(value2)) continue; - index2.set(value2, domain2.push(value2) - 1); - } - return scale2; - }; - scale2.range = function(_) { - return arguments.length ? (range2 = Array.from(_), scale2) : range2.slice(); - }; - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : unknown; - }; - scale2.copy = function() { - return ordinal(domain2, range2).unknown(unknown); - }; - initRange.apply(scale2, arguments); - return scale2; - } - function basis(t12, v0, v1, v2, v3) { - var t22 = t12 * t12, t32 = t22 * t12; - return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6; - } - function basis$1(values2) { - var n = values2.length - 1; - return function(t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values2[i], v2 = values2[i + 1], v0 = i > 0 ? values2[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values2[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - } - function basisClosed(values2) { - var n = values2.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values2[(i + n - 1) % n], v1 = values2[i % n], v2 = values2[(i + 1) % n], v3 = values2[(i + 2) % n]; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - } - const constant$5 = (x2) => () => x2; - function linear$2(a2, d2) { - return function(t) { - return a2 + t * d2; - }; - } - function exponential(a2, b2, y2) { - return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t) { - return Math.pow(a2 + t * b2, y2); - }; - } - function hue$1(a2, b2) { - var d2 = b2 - a2; - return d2 ? linear$2(a2, d2 > 180 || d2 < -180 ? d2 - 360 * Math.round(d2 / 360) : d2) : constant$5(isNaN(a2) ? b2 : a2); - } - function gamma(y2) { - return (y2 = +y2) === 1 ? nogamma : function(a2, b2) { - return b2 - a2 ? exponential(a2, b2, y2) : constant$5(isNaN(a2) ? b2 : a2); - }; - } - function nogamma(a2, b2) { - var d2 = b2 - a2; - return d2 ? linear$2(a2, d2) : constant$5(isNaN(a2) ? b2 : a2); - } - const rgb = (function rgbGamma(y2) { - var color2 = gamma(y2); - function rgb2(start, end) { - var r = color2((start = rgb$1(start)).r, (end = rgb$1(end)).r), g = color2(start.g, end.g), b2 = color2(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b2(t); - start.opacity = opacity2(t); - return start + ""; - }; - } - rgb2.gamma = rgbGamma; - return rgb2; - })(1); - function rgbSpline(spline) { - return function(colors2) { - var n = colors2.length, r = new Array(n), g = new Array(n), b2 = new Array(n), i, color2; - for (i = 0; i < n; ++i) { - color2 = rgb$1(colors2[i]); - r[i] = color2.r || 0; - g[i] = color2.g || 0; - b2[i] = color2.b || 0; - } - r = spline(r); - g = spline(g); - b2 = spline(b2); - color2.opacity = 1; - return function(t) { - color2.r = r(t); - color2.g = g(t); - color2.b = b2(t); - return color2 + ""; - }; - }; - } - var rgbBasis = rgbSpline(basis$1); - var rgbBasisClosed = rgbSpline(basisClosed); - function numberArray(a2, b2) { - if (!b2) b2 = []; - var n = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i; - return function(t) { - for (i = 0; i < n; ++i) c2[i] = a2[i] * (1 - t) + b2[i] * t; - return c2; - }; - } - function isNumberArray(x2) { - return ArrayBuffer.isView(x2) && !(x2 instanceof DataView); - } - function array$5(a2, b2) { - return (isNumberArray(b2) ? numberArray : genericArray)(a2, b2); - } - function genericArray(a2, b2) { - var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i; - for (i = 0; i < na; ++i) x2[i] = interpolate$1(a2[i], b2[i]); - for (; i < nb; ++i) c2[i] = b2[i]; - return function(t) { - for (i = 0; i < na; ++i) c2[i] = x2[i](t); - return c2; - }; - } - function date$1(a2, b2) { - var d2 = /* @__PURE__ */ new Date(); - return a2 = +a2, b2 = +b2, function(t) { - return d2.setTime(a2 * (1 - t) + b2 * t), d2; - }; - } - function interpolateNumber(a2, b2) { - return a2 = +a2, b2 = +b2, function(t) { - return a2 * (1 - t) + b2 * t; - }; - } - function object$1(a2, b2) { - var i = {}, c2 = {}, k; - if (a2 === null || typeof a2 !== "object") a2 = {}; - if (b2 === null || typeof b2 !== "object") b2 = {}; - for (k in b2) { - if (k in a2) { - i[k] = interpolate$1(a2[k], b2[k]); - } else { - c2[k] = b2[k]; - } - } - return function(t) { - for (k in i) c2[k] = i[k](t); - return c2; - }; - } - var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); - function zero$2(b2) { - return function() { - return b2; - }; - } - function one$2(b2) { - return function(t) { - return b2(t) + ""; - }; - } - function string(a2, b2) { - var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s2 = [], q = []; - a2 = a2 + "", b2 = b2 + ""; - while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) { - if ((bs = bm.index) > bi) { - bs = b2.slice(bi, bs); - if (s2[i]) s2[i] += bs; - else s2[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { - if (s2[i]) s2[i] += bm; - else s2[++i] = bm; - } else { - s2[++i] = null; - q.push({ i, x: interpolateNumber(am, bm) }); - } - bi = reB.lastIndex; - } - if (bi < b2.length) { - bs = b2.slice(bi); - if (s2[i]) s2[i] += bs; - else s2[++i] = bs; - } - return s2.length < 2 ? q[0] ? one$2(q[0].x) : zero$2(b2) : (b2 = q.length, function(t) { - for (var i2 = 0, o; i2 < b2; ++i2) s2[(o = q[i2]).i] = o.x(t); - return s2.join(""); - }); - } - function interpolate$1(a2, b2) { - var t = typeof b2, c2; - return b2 == null || t === "boolean" ? constant$5(b2) : (t === "number" ? interpolateNumber : t === "string" ? (c2 = color$2(b2)) ? (b2 = c2, rgb) : string : b2 instanceof color$2 ? rgb : b2 instanceof Date ? date$1 : isNumberArray(b2) ? numberArray : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object$1 : interpolateNumber)(a2, b2); - } - function discrete$1(range2) { - var n = range2.length; - return function(t) { - return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; - } - function hue(a2, b2) { - var i = hue$1(+a2, +b2); - return function(t) { - var x2 = i(t); - return x2 - 360 * Math.floor(x2 / 360); - }; - } - function interpolateRound(a2, b2) { - return a2 = +a2, b2 = +b2, function(t) { - return Math.round(a2 * (1 - t) + b2 * t); - }; - } - var degrees$1 = 180 / Math.PI; - var identity$7 = { - translateX: 0, - translateY: 0, - rotate: 0, - skewX: 0, - scaleX: 1, - scaleY: 1 - }; - function decompose(a2, b2, c2, d2, e, f) { - var scaleX, scaleY2, skewX; - if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX; - if (skewX = a2 * c2 + b2 * d2) c2 -= a2 * skewX, d2 -= b2 * skewX; - if (scaleY2 = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY2, d2 /= scaleY2, skewX /= scaleY2; - if (a2 * d2 < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b2, a2) * degrees$1, - skewX: Math.atan(skewX) * degrees$1, - scaleX, - scaleY: scaleY2 - }; - } - var svgNode; - function parseCss(value2) { - const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + ""); - return m2.isIdentity ? identity$7 : decompose(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f); - } - function parseSvg(value2) { - if (value2 == null) return identity$7; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value2); - if (!(value2 = svgNode.transform.baseVal.consolidate())) return identity$7; - value2 = value2.matrix; - return decompose(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f); - } - function interpolateTransform(parse2, pxComma, pxParen, degParen) { - function pop(s2) { - return s2.length ? s2.pop() + " " : ""; - } - function translate2(xa, ya, xb, yb, s2, q) { - if (xa !== xb || ya !== yb) { - var i = s2.push("translate(", null, pxComma, null, pxParen); - q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); - } else if (xb || yb) { - s2.push("translate(" + xb + pxComma + yb + pxParen); - } - } - function rotate2(a2, b2, s2, q) { - if (a2 !== b2) { - if (a2 - b2 > 180) b2 += 360; - else if (b2 - a2 > 180) a2 += 360; - q.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); - } else if (b2) { - s2.push(pop(s2) + "rotate(" + b2 + degParen); - } - } - function skewX(a2, b2, s2, q) { - if (a2 !== b2) { - q.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); - } else if (b2) { - s2.push(pop(s2) + "skewX(" + b2 + degParen); - } - } - function scale2(xa, ya, xb, yb, s2, q) { - if (xa !== xb || ya !== yb) { - var i = s2.push(pop(s2) + "scale(", null, ",", null, ")"); - q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); - } else if (xb !== 1 || yb !== 1) { - s2.push(pop(s2) + "scale(" + xb + "," + yb + ")"); - } - } - return function(a2, b2) { - var s2 = [], q = []; - a2 = parse2(a2), b2 = parse2(b2); - translate2(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q); - rotate2(a2.rotate, b2.rotate, s2, q); - skewX(a2.skewX, b2.skewX, s2, q); - scale2(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q); - a2 = b2 = null; - return function(t) { - var i = -1, n = q.length, o; - while (++i < n) s2[(o = q[i]).i] = o.x(t); - return s2.join(""); - }; - }; - } - var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); - var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); - var epsilon2$1 = 1e-12; - function cosh(x2) { - return ((x2 = Math.exp(x2)) + 1 / x2) / 2; - } - function sinh(x2) { - return ((x2 = Math.exp(x2)) - 1 / x2) / 2; - } - function tanh(x2) { - return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1); - } - const zoom$1 = (function zoomRho(rho, rho2, rho4) { - function zoom2(p02, p1) { - var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; - if (d2 < epsilon2$1) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } else { - var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s2 = t * S, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0)); - return [ - ux0 + u2 * dx, - uy0 + u2 * dy, - w0 * coshr0 / cosh(rho * s2 + r0) - ]; - }; - } - i.duration = S * 1e3 * rho / Math.SQRT2; - return i; - } - zoom2.rho = function(_) { - var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; - return zoomRho(_1, _2, _4); - }; - return zoom2; - })(Math.SQRT2, 2, 4); - function hsl(hue2) { - return function(start, end) { - var h2 = hue2((start = hsl$1(start)).h, (end = hsl$1(end)).h), s2 = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h2(t); - start.s = s2(t); - start.l = l(t); - start.opacity = opacity2(t); - return start + ""; - }; - }; - } - const hsl_default = hsl(hue$1); - var hslLong = hsl(nogamma); - function lab(start, end) { - var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l), a2 = nogamma(start.a, end.a), b2 = nogamma(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); - return function(t) { - start.l = l(t); - start.a = a2(t); - start.b = b2(t); - start.opacity = opacity2(t); - return start + ""; - }; - } - function hcl(hue2) { - return function(start, end) { - var h2 = hue2((start = hcl$1(start)).h, (end = hcl$1(end)).h), c2 = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h2(t); - start.c = c2(t); - start.l = l(t); - start.opacity = opacity2(t); - return start + ""; - }; - }; - } - const hcl_default = hcl(hue$1); - var hclLong = hcl(nogamma); - function cubehelix(hue2) { - return (function cubehelixGamma(y2) { - y2 = +y2; - function cubehelix2(start, end) { - var h2 = hue2((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h), s2 = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h2(t); - start.s = s2(t); - start.l = l(Math.pow(t, y2)); - start.opacity = opacity2(t); - return start + ""; - }; - } - cubehelix2.gamma = cubehelixGamma; - return cubehelix2; - })(1); - } - const cubehelix_default = cubehelix(hue$1); - var cubehelixLong = cubehelix(nogamma); - function piecewise(interpolate2, values2) { - if (values2 === void 0) values2 = interpolate2, interpolate2 = interpolate$1; - var i = 0, n = values2.length - 1, v = values2[0], I = new Array(n < 0 ? 0 : n); - while (i < n) I[i] = interpolate2(v, v = values2[++i]); - return function(t) { - var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i2](t - i2); - }; - } - function quantize$2(interpolator, n) { - var samples = new Array(n); - for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); - return samples; - } - const $$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - interpolate: interpolate$1, - interpolateArray: array$5, - interpolateBasis: basis$1, - interpolateBasisClosed: basisClosed, - interpolateCubehelix: cubehelix_default, - interpolateCubehelixLong: cubehelixLong, - interpolateDate: date$1, - interpolateDiscrete: discrete$1, - interpolateHcl: hcl_default, - interpolateHclLong: hclLong, - interpolateHsl: hsl_default, - interpolateHslLong: hslLong, - interpolateHue: hue, - interpolateLab: lab, - interpolateNumber, - interpolateNumberArray: numberArray, - interpolateObject: object$1, - interpolateRgb: rgb, - interpolateRgbBasis: rgbBasis, - interpolateRgbBasisClosed: rgbBasisClosed, - interpolateRound, - interpolateString: string, - interpolateTransformCss, - interpolateTransformSvg, - interpolateZoom: zoom$1, - piecewise, - quantize: quantize$2 - }, Symbol.toStringTag, { value: "Module" })); - function constants(x2) { - return function() { - return x2; - }; - } - function number$5(x2) { - return +x2; - } - var unit = [0, 1]; - function identity$6(x2) { - return x2; - } - function normalize$2(a2, b2) { - return (b2 -= a2 = +a2) ? function(x2) { - return (x2 - a2) / b2; - } : constants(isNaN(b2) ? NaN : 0.5); - } - function clamper(a2, b2) { - var t; - if (a2 > b2) t = a2, a2 = b2, b2 = t; - return function(x2) { - return Math.max(a2, Math.min(b2, x2)); - }; - } - function bimap(domain2, range2, interpolate2) { - var d0 = domain2[0], d1 = domain2[1], r0 = range2[0], r1 = range2[1]; - if (d1 < d0) d0 = normalize$2(d1, d0), r0 = interpolate2(r1, r0); - else d0 = normalize$2(d0, d1), r0 = interpolate2(r0, r1); - return function(x2) { - return r0(d0(x2)); - }; - } - function polymap(domain2, range2, interpolate2) { - var j = Math.min(domain2.length, range2.length) - 1, d2 = new Array(j), r = new Array(j), i = -1; - if (domain2[j] < domain2[0]) { - domain2 = domain2.slice().reverse(); - range2 = range2.slice().reverse(); - } - while (++i < j) { - d2[i] = normalize$2(domain2[i], domain2[i + 1]); - r[i] = interpolate2(range2[i], range2[i + 1]); - } - return function(x2) { - var i2 = bisectRight$1(domain2, x2, 1, j) - 1; - return r[i2](d2[i2](x2)); - }; - } - function copy$2(source2, target2) { - return target2.domain(source2.domain()).range(source2.range()).interpolate(source2.interpolate()).clamp(source2.clamp()).unknown(source2.unknown()); - } - function transformer$3() { - var domain2 = unit, range2 = unit, interpolate2 = interpolate$1, transform2, untransform, unknown, clamp2 = identity$6, piecewise2, output2, input; - function rescale() { - var n = Math.min(domain2.length, range2.length); - if (clamp2 !== identity$6) clamp2 = clamper(domain2[0], domain2[n - 1]); - piecewise2 = n > 2 ? polymap : bimap; - output2 = input = null; - return scale2; - } - function scale2(x2) { - return x2 == null || isNaN(x2 = +x2) ? unknown : (output2 || (output2 = piecewise2(domain2.map(transform2), range2, interpolate2)))(transform2(clamp2(x2))); - } - scale2.invert = function(y2) { - return clamp2(untransform((input || (input = piecewise2(range2, domain2.map(transform2), interpolateNumber)))(y2))); - }; - scale2.domain = function(_) { - return arguments.length ? (domain2 = Array.from(_, number$5), rescale()) : domain2.slice(); - }; - scale2.range = function(_) { - return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); - }; - scale2.rangeRound = function(_) { - return range2 = Array.from(_), interpolate2 = interpolateRound, rescale(); - }; - scale2.clamp = function(_) { - return arguments.length ? (clamp2 = _ ? true : identity$6, rescale()) : clamp2 !== identity$6; - }; - scale2.interpolate = function(_) { - return arguments.length ? (interpolate2 = _, rescale()) : interpolate2; - }; - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : unknown; - }; - return function(t, u2) { - transform2 = t, untransform = u2; - return rescale(); - }; - } - function continuous$1() { - return transformer$3()(identity$6, identity$6); - } - function formatDecimal$1(x2) { - return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); - } - function formatDecimalParts$1(x2, p) { - if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; - var i, coefficient = x2.slice(0, i); - return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x2.slice(i + 1) - ]; - } - function exponent$1(x2) { - return x2 = formatDecimalParts$1(Math.abs(x2)), x2 ? x2[1] : NaN; - } - function formatGroup$1(grouping, thousands) { - return function(value2, width2) { - var i = value2.length, t = [], j = 0, g = grouping[0], length2 = 0; - while (i > 0 && g > 0) { - if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); - t.push(value2.substring(i -= g, i + g)); - if ((length2 += g + 1) > width2) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; - } - function formatNumerals$1(numerals) { - return function(value2) { - return value2.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; - } - var re$1 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; - function formatSpecifier$1(specifier) { - if (!(match2 = re$1.exec(specifier))) throw new Error("invalid format: " + specifier); - var match2; - return new FormatSpecifier$1({ - fill: match2[1], - align: match2[2], - sign: match2[3], - symbol: match2[4], - zero: match2[5], - width: match2[6], - comma: match2[7], - precision: match2[8] && match2[8].slice(1), - trim: match2[9], - type: match2[10] - }); - } - formatSpecifier$1.prototype = FormatSpecifier$1.prototype; - function FormatSpecifier$1(specifier) { - this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; - this.align = specifier.align === void 0 ? ">" : specifier.align + ""; - this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === void 0 ? void 0 : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === void 0 ? "" : specifier.type + ""; - } - FormatSpecifier$1.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; - }; - function formatTrim$1(s2) { - out: for (var n = s2.length, i = 1, i0 = -1, i1; i < n; ++i) { - switch (s2[i]) { - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s2[i]) break out; - if (i0 > 0) i0 = 0; - break; - } - } - return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2; - } - var prefixExponent$1; - function formatPrefixAuto$1(x2, p) { - var d2 = formatDecimalParts$1(x2, p); - if (!d2) return x2 + ""; - var coefficient = d2[0], exponent2 = d2[1], i = exponent2 - (prefixExponent$1 = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts$1(x2, Math.max(0, p + i - 1))[0]; - } - function formatRounded$1(x2, p) { - var d2 = formatDecimalParts$1(x2, p); - if (!d2) return x2 + ""; - var coefficient = d2[0], exponent2 = d2[1]; - return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); - } - const formatTypes$1 = { - "%": (x2, p) => (x2 * 100).toFixed(p), - "b": (x2) => Math.round(x2).toString(2), - "c": (x2) => x2 + "", - "d": formatDecimal$1, - "e": (x2, p) => x2.toExponential(p), - "f": (x2, p) => x2.toFixed(p), - "g": (x2, p) => x2.toPrecision(p), - "o": (x2) => Math.round(x2).toString(8), - "p": (x2, p) => formatRounded$1(x2 * 100, p), - "r": formatRounded$1, - "s": formatPrefixAuto$1, - "X": (x2) => Math.round(x2).toString(16).toUpperCase(), - "x": (x2) => Math.round(x2).toString(16) - }; - function identity$5(x2) { - return x2; - } - var map$3 = Array.prototype.map, prefixes$1 = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; - function formatLocale$2(locale2) { - var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$5 : formatGroup$1(map$3.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$5 : formatNumerals$1(map$3.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "−" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; - function newFormat(specifier) { - specifier = formatSpecifier$1(specifier); - var fill2 = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol2 = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type; - if (type2 === "n") comma = true, type2 = "g"; - else if (!formatTypes$1[type2]) precision === void 0 && (precision = 12), trim = true, type2 = "g"; - if (zero2 || fill2 === "0" && align === "=") zero2 = true, fill2 = "0", align = "="; - var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; - var formatType = formatTypes$1[type2], maybeSuffix = /[defgprs%]/.test(type2); - precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format2(value2) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; - if (type2 === "c") { - valueSuffix = formatType(value2) + valueSuffix; - value2 = ""; - } else { - value2 = +value2; - var valueNegative = value2 < 0 || 1 / value2 < 0; - value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); - if (trim) value2 = formatTrim$1(value2); - if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; - valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; - valueSuffix = (type2 === "s" ? prefixes$1[8 + prefixExponent$1 / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); - if (maybeSuffix) { - i = -1, n = value2.length; - while (++i < n) { - if (c2 = value2.charCodeAt(i), 48 > c2 || c2 > 57) { - valueSuffix = (c2 === 46 ? decimal + value2.slice(i + 1) : value2.slice(i)) + valueSuffix; - value2 = value2.slice(0, i); - break; - } - } - } - } - if (comma && !zero2) value2 = group2(value2, Infinity); - var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) : ""; - if (comma && zero2) value2 = group2(padding2 + value2, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; - switch (align) { - case "<": - value2 = valuePrefix + value2 + valueSuffix + padding2; - break; - case "=": - value2 = valuePrefix + padding2 + value2 + valueSuffix; - break; - case "^": - value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); - break; - default: - value2 = padding2 + valuePrefix + value2 + valueSuffix; - break; - } - return numerals(value2); - } - format2.toString = function() { - return specifier + ""; - }; - return format2; - } - function formatPrefix2(specifier, value2) { - var f = newFormat((specifier = formatSpecifier$1(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent$1(value2) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes$1[8 + e / 3]; - return function(value3) { - return f(k * value3) + prefix; - }; - } - return { - format: newFormat, - formatPrefix: formatPrefix2 - }; - } - var locale$3; - var format$4; - var formatPrefix; - defaultLocale$3({ - thousands: ",", - grouping: [3], - currency: ["$", ""] - }); - function defaultLocale$3(definition2) { - locale$3 = formatLocale$2(definition2); - format$4 = locale$3.format; - formatPrefix = locale$3.formatPrefix; - return locale$3; - } - function precisionFixed(step) { - return Math.max(0, -exponent$1(Math.abs(step))); - } - function precisionPrefix(step, value2) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value2) / 3))) * 3 - exponent$1(Math.abs(step))); - } - function precisionRound(step, max2) { - step = Math.abs(step), max2 = Math.abs(max2) - step; - return Math.max(0, exponent$1(max2) - exponent$1(step)) + 1; - } - function tickFormat$1(start, stop2, count2, specifier) { - var step = tickStep(start, stop2, count2), precision; - specifier = formatSpecifier$1(specifier == null ? ",f" : specifier); - switch (specifier.type) { - case "s": { - var value2 = Math.max(Math.abs(start), Math.abs(stop2)); - if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value2))) specifier.precision = precision; - return formatPrefix(specifier, value2); - } - case "": - case "e": - case "g": - case "p": - case "r": { - if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop2))))) specifier.precision = precision - (specifier.type === "e"); - break; - } - case "f": - case "%": { - if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - } - return format$4(specifier); - } - function linearish(scale2) { - var domain2 = scale2.domain; - scale2.ticks = function(count2) { - var d2 = domain2(); - return ticks(d2[0], d2[d2.length - 1], count2 == null ? 10 : count2); - }; - scale2.tickFormat = function(count2, specifier) { - var d2 = domain2(); - return tickFormat$1(d2[0], d2[d2.length - 1], count2 == null ? 10 : count2, specifier); - }; - scale2.nice = function(count2) { - if (count2 == null) count2 = 10; - var d2 = domain2(); - var i0 = 0; - var i1 = d2.length - 1; - var start = d2[i0]; - var stop2 = d2[i1]; - var prestep; - var step; - var maxIter = 10; - if (stop2 < start) { - step = start, start = stop2, stop2 = step; - step = i0, i0 = i1, i1 = step; - } - while (maxIter-- > 0) { - step = tickIncrement(start, stop2, count2); - if (step === prestep) { - d2[i0] = start; - d2[i1] = stop2; - return domain2(d2); - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop2 = Math.ceil(stop2 / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop2 = Math.floor(stop2 * step) / step; - } else { - break; - } - prestep = step; - } - return scale2; - }; - return scale2; - } - function linear$1() { - var scale2 = continuous$1(); - scale2.copy = function() { - return copy$2(scale2, linear$1()); - }; - initRange.apply(scale2, arguments); - return linearish(scale2); - } - function identity$4(domain2) { - var unknown; - function scale2(x2) { - return x2 == null || isNaN(x2 = +x2) ? unknown : x2; - } - scale2.invert = scale2; - scale2.domain = scale2.range = function(_) { - return arguments.length ? (domain2 = Array.from(_, number$5), scale2) : domain2.slice(); - }; - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : unknown; - }; - scale2.copy = function() { - return identity$4(domain2).unknown(unknown); - }; - domain2 = arguments.length ? Array.from(domain2, number$5) : [0, 1]; - return linearish(scale2); - } - function nice(domain2, interval2) { - domain2 = domain2.slice(); - var i0 = 0, i1 = domain2.length - 1, x02 = domain2[i0], x12 = domain2[i1], t; - if (x12 < x02) { - t = i0, i0 = i1, i1 = t; - t = x02, x02 = x12, x12 = t; - } - domain2[i0] = interval2.floor(x02); - domain2[i1] = interval2.ceil(x12); - return domain2; - } - function transformLog(x2) { - return Math.log(x2); - } - function transformExp(x2) { - return Math.exp(x2); - } - function transformLogn(x2) { - return -Math.log(-x2); - } - function transformExpn(x2) { - return -Math.exp(-x2); - } - function pow10(x2) { - return isFinite(x2) ? +("1e" + x2) : x2 < 0 ? 0 : x2; - } - function powp(base2) { - return base2 === 10 ? pow10 : base2 === Math.E ? Math.exp : (x2) => Math.pow(base2, x2); - } - function logp(base2) { - return base2 === Math.E ? Math.log : base2 === 10 && Math.log10 || base2 === 2 && Math.log2 || (base2 = Math.log(base2), (x2) => Math.log(x2) / base2); - } - function reflect(f) { - return (x2, k) => -f(-x2, k); - } - function loggish(transform2) { - const scale2 = transform2(transformLog, transformExp); - const domain2 = scale2.domain; - let base2 = 10; - let logs; - let pows; - function rescale() { - logs = logp(base2), pows = powp(base2); - if (domain2()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform2(transformLogn, transformExpn); - } else { - transform2(transformLog, transformExp); - } - return scale2; - } - scale2.base = function(_) { - return arguments.length ? (base2 = +_, rescale()) : base2; - }; - scale2.domain = function(_) { - return arguments.length ? (domain2(_), rescale()) : domain2(); - }; - scale2.ticks = (count2) => { - const d2 = domain2(); - let u2 = d2[0]; - let v = d2[d2.length - 1]; - const r = v < u2; - if (r) [u2, v] = [v, u2]; - let i = logs(u2); - let j = logs(v); - let k; - let t; - const n = count2 == null ? 10 : +count2; - let z2 = []; - if (!(base2 % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u2 > 0) for (; i <= j; ++i) { - for (k = 1; k < base2; ++k) { - t = i < 0 ? k / pows(-i) : k * pows(i); - if (t < u2) continue; - if (t > v) break; - z2.push(t); - } - } - else for (; i <= j; ++i) { - for (k = base2 - 1; k >= 1; --k) { - t = i > 0 ? k / pows(-i) : k * pows(i); - if (t < u2) continue; - if (t > v) break; - z2.push(t); - } - } - if (z2.length * 2 < n) z2 = ticks(u2, v, n); - } else { - z2 = ticks(i, j, Math.min(j - i, n)).map(pows); - } - return r ? z2.reverse() : z2; - }; - scale2.tickFormat = (count2, specifier) => { - if (count2 == null) count2 = 10; - if (specifier == null) specifier = base2 === 10 ? "s" : ","; - if (typeof specifier !== "function") { - if (!(base2 % 1) && (specifier = formatSpecifier$1(specifier)).precision == null) specifier.trim = true; - specifier = format$4(specifier); - } - if (count2 === Infinity) return specifier; - const k = Math.max(1, base2 * count2 / scale2.ticks().length); - return (d2) => { - let i = d2 / pows(Math.round(logs(d2))); - if (i * base2 < base2 - 0.5) i *= base2; - return i <= k ? specifier(d2) : ""; - }; - }; - scale2.nice = () => { - return domain2(nice(domain2(), { - floor: (x2) => pows(Math.floor(logs(x2))), - ceil: (x2) => pows(Math.ceil(logs(x2))) - })); - }; - return scale2; - } - function log$4() { - const scale2 = loggish(transformer$3()).domain([1, 10]); - scale2.copy = () => copy$2(scale2, log$4()).base(scale2.base()); - initRange.apply(scale2, arguments); - return scale2; - } - function transformSymlog(c2) { - return function(x2) { - return Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); - }; - } - function transformSymexp(c2) { - return function(x2) { - return Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; - }; - } - function symlogish(transform2) { - var c2 = 1, scale2 = transform2(transformSymlog(c2), transformSymexp(c2)); - scale2.constant = function(_) { - return arguments.length ? transform2(transformSymlog(c2 = +_), transformSymexp(c2)) : c2; - }; - return linearish(scale2); - } - function symlog$1() { - var scale2 = symlogish(transformer$3()); - scale2.copy = function() { - return copy$2(scale2, symlog$1()).constant(scale2.constant()); - }; - return initRange.apply(scale2, arguments); - } - function transformPow(exponent2) { - return function(x2) { - return x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); - }; - } - function transformSqrt(x2) { - return x2 < 0 ? -Math.sqrt(-x2) : Math.sqrt(x2); - } - function transformSquare(x2) { - return x2 < 0 ? -x2 * x2 : x2 * x2; - } - function powish(transform2) { - var scale2 = transform2(identity$6, identity$6), exponent2 = 1; - function rescale() { - return exponent2 === 1 ? transform2(identity$6, identity$6) : exponent2 === 0.5 ? transform2(transformSqrt, transformSquare) : transform2(transformPow(exponent2), transformPow(1 / exponent2)); - } - scale2.exponent = function(_) { - return arguments.length ? (exponent2 = +_, rescale()) : exponent2; - }; - return linearish(scale2); - } - function pow$4() { - var scale2 = powish(transformer$3()); - scale2.copy = function() { - return copy$2(scale2, pow$4()).exponent(scale2.exponent()); - }; - initRange.apply(scale2, arguments); - return scale2; - } - function sqrt$3() { - return pow$4.apply(null, arguments).exponent(0.5); - } - function quantile() { - var domain2 = [], range2 = [], thresholds = [], unknown; - function rescale() { - var i = 0, n = Math.max(1, range2.length); - thresholds = new Array(n - 1); - while (++i < n) thresholds[i - 1] = quantileSorted(domain2, i / n); - return scale2; - } - function scale2(x2) { - return x2 == null || isNaN(x2 = +x2) ? unknown : range2[bisectRight$1(thresholds, x2)]; - } - scale2.invertExtent = function(y2) { - var i = range2.indexOf(y2); - return i < 0 ? [NaN, NaN] : [ - i > 0 ? thresholds[i - 1] : domain2[0], - i < thresholds.length ? thresholds[i] : domain2[domain2.length - 1] - ]; - }; - scale2.domain = function(_) { - if (!arguments.length) return domain2.slice(); - domain2 = []; - for (let d2 of _) if (d2 != null && !isNaN(d2 = +d2)) domain2.push(d2); - domain2.sort(ascending$2); - return rescale(); - }; - scale2.range = function(_) { - return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); - }; - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : unknown; - }; - scale2.quantiles = function() { - return thresholds.slice(); - }; - scale2.copy = function() { - return quantile().domain(domain2).range(range2).unknown(unknown); - }; - return initRange.apply(scale2, arguments); - } - function quantize$1() { - var x02 = 0, x12 = 1, n = 1, domain2 = [0.5], range2 = [0, 1], unknown; - function scale2(x2) { - return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; - } - function rescale() { - var i = -1; - domain2 = new Array(n); - while (++i < n) domain2[i] = ((i + 1) * x12 - (i - n) * x02) / (n + 1); - return scale2; - } - scale2.domain = function(_) { - return arguments.length ? ([x02, x12] = _, x02 = +x02, x12 = +x12, rescale()) : [x02, x12]; - }; - scale2.range = function(_) { - return arguments.length ? (n = (range2 = Array.from(_)).length - 1, rescale()) : range2.slice(); - }; - scale2.invertExtent = function(y2) { - var i = range2.indexOf(y2); - return i < 0 ? [NaN, NaN] : i < 1 ? [x02, domain2[0]] : i >= n ? [domain2[n - 1], x12] : [domain2[i - 1], domain2[i]]; - }; - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : scale2; - }; - scale2.thresholds = function() { - return domain2.slice(); - }; - scale2.copy = function() { - return quantize$1().domain([x02, x12]).range(range2).unknown(unknown); - }; - return initRange.apply(linearish(scale2), arguments); - } - function threshold() { - var domain2 = [0.5], range2 = [0, 1], unknown, n = 1; - function scale2(x2) { - return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; - } - scale2.domain = function(_) { - return arguments.length ? (domain2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : domain2.slice(); - }; - scale2.range = function(_) { - return arguments.length ? (range2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : range2.slice(); - }; - scale2.invertExtent = function(y2) { - var i = range2.indexOf(y2); - return [domain2[i - 1], domain2[i]]; - }; - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : unknown; - }; - scale2.copy = function() { - return threshold().domain(domain2).range(range2).unknown(unknown); - }; - return initRange.apply(scale2, arguments); - } - const t0$1 = /* @__PURE__ */ new Date(), t1 = /* @__PURE__ */ new Date(); - function timeInterval$1(floori, offseti, count2, field2) { - function interval2(date2) { - return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2; - } - interval2.floor = (date2) => { - return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2; - }; - interval2.ceil = (date2) => { - return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2; - }; - interval2.round = (date2) => { - const d0 = interval2(date2), d1 = interval2.ceil(date2); - return date2 - d0 < d1 - date2 ? d0 : d1; - }; - interval2.offset = (date2, step) => { - return offseti(date2 = /* @__PURE__ */ new Date(+date2), step == null ? 1 : Math.floor(step)), date2; - }; - interval2.range = (start, stop2, step) => { - const range2 = []; - start = interval2.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop2) || !(step > 0)) return range2; - let previous; - do - range2.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop2); - return range2; - }; - interval2.filter = (test2) => { - return timeInterval$1((date2) => { - if (date2 >= date2) while (floori(date2), !test2(date2)) date2.setTime(date2 - 1); - }, (date2, step) => { - if (date2 >= date2) { - if (step < 0) while (++step <= 0) { - while (offseti(date2, -1), !test2(date2)) { - } - } - else while (--step >= 0) { - while (offseti(date2, 1), !test2(date2)) { - } - } - } - }); - }; - if (count2) { - interval2.count = (start, end) => { - t0$1.setTime(+start), t1.setTime(+end); - floori(t0$1), floori(t1); - return Math.floor(count2(t0$1, t1)); - }; - interval2.every = (step) => { - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field2 ? (d2) => field2(d2) % step === 0 : (d2) => interval2.count(0, d2) % step === 0); - }; - } - return interval2; - } - const millisecond = timeInterval$1(() => { - }, (date2, step) => { - date2.setTime(+date2 + step); - }, (start, end) => { - return end - start; - }); - millisecond.every = (k) => { - k = Math.floor(k); - if (!isFinite(k) || !(k > 0)) return null; - if (!(k > 1)) return millisecond; - return timeInterval$1((date2) => { - date2.setTime(Math.floor(date2 / k) * k); - }, (date2, step) => { - date2.setTime(+date2 + step * k); - }, (start, end) => { - return (end - start) / k; - }); - }; - millisecond.range; - const durationSecond$1 = 1e3; - const durationMinute$1 = durationSecond$1 * 60; - const durationHour$1 = durationMinute$1 * 60; - const durationDay$1 = durationHour$1 * 24; - const durationWeek$1 = durationDay$1 * 7; - const durationMonth$1 = durationDay$1 * 30; - const durationYear$1 = durationDay$1 * 365; - const second = timeInterval$1((date2) => { - date2.setTime(date2 - date2.getMilliseconds()); - }, (date2, step) => { - date2.setTime(+date2 + step * durationSecond$1); - }, (start, end) => { - return (end - start) / durationSecond$1; - }, (date2) => { - return date2.getUTCSeconds(); - }); - second.range; - const timeMinute = timeInterval$1((date2) => { - date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1); - }, (date2, step) => { - date2.setTime(+date2 + step * durationMinute$1); - }, (start, end) => { - return (end - start) / durationMinute$1; - }, (date2) => { - return date2.getMinutes(); - }); - timeMinute.range; - const utcMinute = timeInterval$1((date2) => { - date2.setUTCSeconds(0, 0); - }, (date2, step) => { - date2.setTime(+date2 + step * durationMinute$1); - }, (start, end) => { - return (end - start) / durationMinute$1; - }, (date2) => { - return date2.getUTCMinutes(); - }); - utcMinute.range; - const timeHour = timeInterval$1((date2) => { - date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1 - date2.getMinutes() * durationMinute$1); - }, (date2, step) => { - date2.setTime(+date2 + step * durationHour$1); - }, (start, end) => { - return (end - start) / durationHour$1; - }, (date2) => { - return date2.getHours(); - }); - timeHour.range; - const utcHour = timeInterval$1((date2) => { - date2.setUTCMinutes(0, 0, 0); - }, (date2, step) => { - date2.setTime(+date2 + step * durationHour$1); - }, (start, end) => { - return (end - start) / durationHour$1; - }, (date2) => { - return date2.getUTCHours(); - }); - utcHour.range; - const timeDay = timeInterval$1( - (date2) => date2.setHours(0, 0, 0, 0), - (date2, step) => date2.setDate(date2.getDate() + step), - (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, - (date2) => date2.getDate() - 1 - ); - timeDay.range; - const utcDay = timeInterval$1((date2) => { - date2.setUTCHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setUTCDate(date2.getUTCDate() + step); - }, (start, end) => { - return (end - start) / durationDay$1; - }, (date2) => { - return date2.getUTCDate() - 1; - }); - utcDay.range; - const unixDay = timeInterval$1((date2) => { - date2.setUTCHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setUTCDate(date2.getUTCDate() + step); - }, (start, end) => { - return (end - start) / durationDay$1; - }, (date2) => { - return Math.floor(date2 / durationDay$1); - }); - unixDay.range; - function timeWeekday(i) { - return timeInterval$1((date2) => { - date2.setDate(date2.getDate() - (date2.getDay() + 7 - i) % 7); - date2.setHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setDate(date2.getDate() + step * 7); - }, (start, end) => { - return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1; - }); - } - const timeSunday = timeWeekday(0); - const timeMonday = timeWeekday(1); - const timeTuesday = timeWeekday(2); - const timeWednesday = timeWeekday(3); - const timeThursday = timeWeekday(4); - const timeFriday = timeWeekday(5); - const timeSaturday = timeWeekday(6); - timeSunday.range; - timeMonday.range; - timeTuesday.range; - timeWednesday.range; - timeThursday.range; - timeFriday.range; - timeSaturday.range; - function utcWeekday(i) { - return timeInterval$1((date2) => { - date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i) % 7); - date2.setUTCHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setUTCDate(date2.getUTCDate() + step * 7); - }, (start, end) => { - return (end - start) / durationWeek$1; - }); - } - const utcSunday = utcWeekday(0); - const utcMonday = utcWeekday(1); - const utcTuesday = utcWeekday(2); - const utcWednesday = utcWeekday(3); - const utcThursday = utcWeekday(4); - const utcFriday = utcWeekday(5); - const utcSaturday = utcWeekday(6); - utcSunday.range; - utcMonday.range; - utcTuesday.range; - utcWednesday.range; - utcThursday.range; - utcFriday.range; - utcSaturday.range; - const timeMonth = timeInterval$1((date2) => { - date2.setDate(1); - date2.setHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setMonth(date2.getMonth() + step); - }, (start, end) => { - return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; - }, (date2) => { - return date2.getMonth(); - }); - timeMonth.range; - const utcMonth = timeInterval$1((date2) => { - date2.setUTCDate(1); - date2.setUTCHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setUTCMonth(date2.getUTCMonth() + step); - }, (start, end) => { - return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; - }, (date2) => { - return date2.getUTCMonth(); - }); - utcMonth.range; - const timeYear = timeInterval$1((date2) => { - date2.setMonth(0, 1); - date2.setHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setFullYear(date2.getFullYear() + step); - }, (start, end) => { - return end.getFullYear() - start.getFullYear(); - }, (date2) => { - return date2.getFullYear(); - }); - timeYear.every = (k) => { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { - date2.setFullYear(Math.floor(date2.getFullYear() / k) * k); - date2.setMonth(0, 1); - date2.setHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setFullYear(date2.getFullYear() + step * k); - }); - }; - timeYear.range; - const utcYear = timeInterval$1((date2) => { - date2.setUTCMonth(0, 1); - date2.setUTCHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setUTCFullYear(date2.getUTCFullYear() + step); - }, (start, end) => { - return end.getUTCFullYear() - start.getUTCFullYear(); - }, (date2) => { - return date2.getUTCFullYear(); - }); - utcYear.every = (k) => { - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { - date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k) * k); - date2.setUTCMonth(0, 1); - date2.setUTCHours(0, 0, 0, 0); - }, (date2, step) => { - date2.setUTCFullYear(date2.getUTCFullYear() + step * k); - }); - }; - utcYear.range; - function ticker(year, month, week2, day, hour, minute) { - const tickIntervals = [ - [second, 1, durationSecond$1], - [second, 5, 5 * durationSecond$1], - [second, 15, 15 * durationSecond$1], - [second, 30, 30 * durationSecond$1], - [minute, 1, durationMinute$1], - [minute, 5, 5 * durationMinute$1], - [minute, 15, 15 * durationMinute$1], - [minute, 30, 30 * durationMinute$1], - [hour, 1, durationHour$1], - [hour, 3, 3 * durationHour$1], - [hour, 6, 6 * durationHour$1], - [hour, 12, 12 * durationHour$1], - [day, 1, durationDay$1], - [day, 2, 2 * durationDay$1], - [week2, 1, durationWeek$1], - [month, 1, durationMonth$1], - [month, 3, 3 * durationMonth$1], - [year, 1, durationYear$1] - ]; - function ticks2(start, stop2, count2) { - const reverse2 = stop2 < start; - if (reverse2) [start, stop2] = [stop2, start]; - const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval(start, stop2, count2); - const ticks3 = interval2 ? interval2.range(start, +stop2 + 1) : []; - return reverse2 ? ticks3.reverse() : ticks3; - } - function tickInterval(start, stop2, count2) { - const target2 = Math.abs(stop2 - start) / count2; - const i = bisector(([, , step2]) => step2).right(tickIntervals, target2); - if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop2 / durationYear$1, count2)); - if (i === 0) return millisecond.every(Math.max(tickStep(start, stop2, count2), 1)); - const [t, step] = tickIntervals[target2 / tickIntervals[i - 1][2] < tickIntervals[i][2] / target2 ? i - 1 : i]; - return t.every(step); - } - return [ticks2, tickInterval]; - } - const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute); - const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute); - function localDate$1(d2) { - if (0 <= d2.y && d2.y < 100) { - var date2 = new Date(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L); - date2.setFullYear(d2.y); - return date2; - } - return new Date(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L); - } - function utcDate$1(d2) { - if (0 <= d2.y && d2.y < 100) { - var date2 = new Date(Date.UTC(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L)); - date2.setUTCFullYear(d2.y); - return date2; - } - return new Date(Date.UTC(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L)); - } - function newDate(y2, m2, d2) { - return { y: y2, m: m2, d: d2, H: 0, M: 0, S: 0, L: 0 }; - } - function formatLocale$1(locale2) { - var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths; - var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); - var formats2 = { - "a": formatShortWeekday, - "A": formatWeekday, - "b": formatShortMonth, - "B": formatMonth, - "c": null, - "d": formatDayOfMonth, - "e": formatDayOfMonth, - "f": formatMicroseconds, - "g": formatYearISO, - "G": formatFullYearISO, - "H": formatHour24, - "I": formatHour12, - "j": formatDayOfYear, - "L": formatMilliseconds, - "m": formatMonthNumber, - "M": formatMinutes, - "p": formatPeriod, - "q": formatQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatSeconds, - "u": formatWeekdayNumberMonday, - "U": formatWeekNumberSunday, - "V": formatWeekNumberISO, - "w": formatWeekdayNumberSunday, - "W": formatWeekNumberMonday, - "x": null, - "X": null, - "y": formatYear$1, - "Y": formatFullYear, - "Z": formatZone, - "%": formatLiteralPercent - }; - var utcFormats = { - "a": formatUTCShortWeekday, - "A": formatUTCWeekday, - "b": formatUTCShortMonth, - "B": formatUTCMonth, - "c": null, - "d": formatUTCDayOfMonth, - "e": formatUTCDayOfMonth, - "f": formatUTCMicroseconds, - "g": formatUTCYearISO, - "G": formatUTCFullYearISO, - "H": formatUTCHour24, - "I": formatUTCHour12, - "j": formatUTCDayOfYear, - "L": formatUTCMilliseconds, - "m": formatUTCMonthNumber, - "M": formatUTCMinutes, - "p": formatUTCPeriod, - "q": formatUTCQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatUTCSeconds, - "u": formatUTCWeekdayNumberMonday, - "U": formatUTCWeekNumberSunday, - "V": formatUTCWeekNumberISO, - "w": formatUTCWeekdayNumberSunday, - "W": formatUTCWeekNumberMonday, - "x": null, - "X": null, - "y": formatUTCYear, - "Y": formatUTCFullYear, - "Z": formatUTCZone, - "%": formatLiteralPercent - }; - var parses = { - "a": parseShortWeekday, - "A": parseWeekday, - "b": parseShortMonth, - "B": parseMonth, - "c": parseLocaleDateTime, - "d": parseDayOfMonth, - "e": parseDayOfMonth, - "f": parseMicroseconds, - "g": parseYear, - "G": parseFullYear, - "H": parseHour24, - "I": parseHour24, - "j": parseDayOfYear, - "L": parseMilliseconds, - "m": parseMonthNumber, - "M": parseMinutes, - "p": parsePeriod, - "q": parseQuarter, - "Q": parseUnixTimestamp, - "s": parseUnixTimestampSeconds, - "S": parseSeconds, - "u": parseWeekdayNumberMonday, - "U": parseWeekNumberSunday, - "V": parseWeekNumberISO, - "w": parseWeekdayNumberSunday, - "W": parseWeekNumberMonday, - "x": parseLocaleDate, - "X": parseLocaleTime, - "y": parseYear, - "Y": parseFullYear, - "Z": parseZone, - "%": parseLiteralPercent - }; - formats2.x = newFormat(locale_date, formats2); - formats2.X = newFormat(locale_time, formats2); - formats2.c = newFormat(locale_dateTime, formats2); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - function newFormat(specifier, formats3) { - return function(date2) { - var string2 = [], i = -1, j = 0, n = specifier.length, c2, pad2, format2; - if (!(date2 instanceof Date)) date2 = /* @__PURE__ */ new Date(+date2); - while (++i < n) { - if (specifier.charCodeAt(i) === 37) { - string2.push(specifier.slice(j, i)); - if ((pad2 = pads[c2 = specifier.charAt(++i)]) != null) c2 = specifier.charAt(++i); - else pad2 = c2 === "e" ? " " : "0"; - if (format2 = formats3[c2]) c2 = format2(date2, pad2); - string2.push(c2); - j = i + 1; - } - } - string2.push(specifier.slice(j, i)); - return string2.join(""); - }; - } - function newParse(specifier, Z3) { - return function(string2) { - var d2 = newDate(1900, void 0, 1), i = parseSpecifier(d2, specifier, string2 += "", 0), week2, day; - if (i != string2.length) return null; - if ("Q" in d2) return new Date(d2.Q); - if ("s" in d2) return new Date(d2.s * 1e3 + ("L" in d2 ? d2.L : 0)); - if (Z3 && !("Z" in d2)) d2.Z = 0; - if ("p" in d2) d2.H = d2.H % 12 + d2.p * 12; - if (d2.m === void 0) d2.m = "q" in d2 ? d2.q : 0; - if ("V" in d2) { - if (d2.V < 1 || d2.V > 53) return null; - if (!("w" in d2)) d2.w = 1; - if ("Z" in d2) { - week2 = utcDate$1(newDate(d2.y, 0, 1)), day = week2.getUTCDay(); - week2 = day > 4 || day === 0 ? utcMonday.ceil(week2) : utcMonday(week2); - week2 = utcDay.offset(week2, (d2.V - 1) * 7); - d2.y = week2.getUTCFullYear(); - d2.m = week2.getUTCMonth(); - d2.d = week2.getUTCDate() + (d2.w + 6) % 7; - } else { - week2 = localDate$1(newDate(d2.y, 0, 1)), day = week2.getDay(); - week2 = day > 4 || day === 0 ? timeMonday.ceil(week2) : timeMonday(week2); - week2 = timeDay.offset(week2, (d2.V - 1) * 7); - d2.y = week2.getFullYear(); - d2.m = week2.getMonth(); - d2.d = week2.getDate() + (d2.w + 6) % 7; - } - } else if ("W" in d2 || "U" in d2) { - if (!("w" in d2)) d2.w = "u" in d2 ? d2.u % 7 : "W" in d2 ? 1 : 0; - day = "Z" in d2 ? utcDate$1(newDate(d2.y, 0, 1)).getUTCDay() : localDate$1(newDate(d2.y, 0, 1)).getDay(); - d2.m = 0; - d2.d = "W" in d2 ? (d2.w + 6) % 7 + d2.W * 7 - (day + 5) % 7 : d2.w + d2.U * 7 - (day + 6) % 7; - } - if ("Z" in d2) { - d2.H += d2.Z / 100 | 0; - d2.M += d2.Z % 100; - return utcDate$1(d2); - } - return localDate$1(d2); - }; - } - function parseSpecifier(d2, specifier, string2, j) { - var i = 0, n = specifier.length, m2 = string2.length, c2, parse2; - while (i < n) { - if (j >= m2) return -1; - c2 = specifier.charCodeAt(i++); - if (c2 === 37) { - c2 = specifier.charAt(i++); - parse2 = parses[c2 in pads ? specifier.charAt(i++) : c2]; - if (!parse2 || (j = parse2(d2, string2, j)) < 0) return -1; - } else if (c2 != string2.charCodeAt(j++)) { - return -1; - } - } - return j; - } - function parsePeriod(d2, string2, i) { - var n = periodRe.exec(string2.slice(i)); - return n ? (d2.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseShortWeekday(d2, string2, i) { - var n = shortWeekdayRe.exec(string2.slice(i)); - return n ? (d2.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseWeekday(d2, string2, i) { - var n = weekdayRe.exec(string2.slice(i)); - return n ? (d2.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseShortMonth(d2, string2, i) { - var n = shortMonthRe.exec(string2.slice(i)); - return n ? (d2.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseMonth(d2, string2, i) { - var n = monthRe.exec(string2.slice(i)); - return n ? (d2.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseLocaleDateTime(d2, string2, i) { - return parseSpecifier(d2, locale_dateTime, string2, i); - } - function parseLocaleDate(d2, string2, i) { - return parseSpecifier(d2, locale_date, string2, i); - } - function parseLocaleTime(d2, string2, i) { - return parseSpecifier(d2, locale_time, string2, i); - } - function formatShortWeekday(d2) { - return locale_shortWeekdays[d2.getDay()]; - } - function formatWeekday(d2) { - return locale_weekdays[d2.getDay()]; - } - function formatShortMonth(d2) { - return locale_shortMonths[d2.getMonth()]; - } - function formatMonth(d2) { - return locale_months[d2.getMonth()]; - } - function formatPeriod(d2) { - return locale_periods[+(d2.getHours() >= 12)]; - } - function formatQuarter(d2) { - return 1 + ~~(d2.getMonth() / 3); - } - function formatUTCShortWeekday(d2) { - return locale_shortWeekdays[d2.getUTCDay()]; - } - function formatUTCWeekday(d2) { - return locale_weekdays[d2.getUTCDay()]; - } - function formatUTCShortMonth(d2) { - return locale_shortMonths[d2.getUTCMonth()]; - } - function formatUTCMonth(d2) { - return locale_months[d2.getUTCMonth()]; - } - function formatUTCPeriod(d2) { - return locale_periods[+(d2.getUTCHours() >= 12)]; - } - function formatUTCQuarter(d2) { - return 1 + ~~(d2.getUTCMonth() / 3); - } - return { - format: function(specifier) { - var f = newFormat(specifier += "", formats2); - f.toString = function() { - return specifier; - }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { - return specifier; - }; - return p; - }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { - return specifier; - }; - return f; - }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { - return specifier; - }; - return p; - } - }; - } - var pads = { "-": "", "_": " ", "0": "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; - function pad$2(value2, fill2, width2) { - var sign2 = value2 < 0 ? "-" : "", string2 = (sign2 ? -value2 : value2) + "", length2 = string2.length; - return sign2 + (length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) + string2 : string2); - } - function requote(s2) { - return s2.replace(requoteRe, "\\$&"); - } - function formatRe(names) { - return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); - } - function formatLookup(names) { - return new Map(names.map((name, i) => [name.toLowerCase(), i])); - } - function parseWeekdayNumberSunday(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 1)); - return n ? (d2.w = +n[0], i + n[0].length) : -1; - } - function parseWeekdayNumberMonday(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 1)); - return n ? (d2.u = +n[0], i + n[0].length) : -1; - } - function parseWeekNumberSunday(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.U = +n[0], i + n[0].length) : -1; - } - function parseWeekNumberISO(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.V = +n[0], i + n[0].length) : -1; - } - function parseWeekNumberMonday(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.W = +n[0], i + n[0].length) : -1; - } - function parseFullYear(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 4)); - return n ? (d2.y = +n[0], i + n[0].length) : -1; - } - function parseYear(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; - } - function parseZone(d2, string2, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string2.slice(i, i + 6)); - return n ? (d2.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; - } - function parseQuarter(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 1)); - return n ? (d2.q = n[0] * 3 - 3, i + n[0].length) : -1; - } - function parseMonthNumber(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.m = n[0] - 1, i + n[0].length) : -1; - } - function parseDayOfMonth(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.d = +n[0], i + n[0].length) : -1; - } - function parseDayOfYear(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 3)); - return n ? (d2.m = 0, d2.d = +n[0], i + n[0].length) : -1; - } - function parseHour24(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.H = +n[0], i + n[0].length) : -1; - } - function parseMinutes(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.M = +n[0], i + n[0].length) : -1; - } - function parseSeconds(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 2)); - return n ? (d2.S = +n[0], i + n[0].length) : -1; - } - function parseMilliseconds(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 3)); - return n ? (d2.L = +n[0], i + n[0].length) : -1; - } - function parseMicroseconds(d2, string2, i) { - var n = numberRe.exec(string2.slice(i, i + 6)); - return n ? (d2.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; - } - function parseLiteralPercent(d2, string2, i) { - var n = percentRe.exec(string2.slice(i, i + 1)); - return n ? i + n[0].length : -1; - } - function parseUnixTimestamp(d2, string2, i) { - var n = numberRe.exec(string2.slice(i)); - return n ? (d2.Q = +n[0], i + n[0].length) : -1; - } - function parseUnixTimestampSeconds(d2, string2, i) { - var n = numberRe.exec(string2.slice(i)); - return n ? (d2.s = +n[0], i + n[0].length) : -1; - } - function formatDayOfMonth(d2, p) { - return pad$2(d2.getDate(), p, 2); - } - function formatHour24(d2, p) { - return pad$2(d2.getHours(), p, 2); - } - function formatHour12(d2, p) { - return pad$2(d2.getHours() % 12 || 12, p, 2); - } - function formatDayOfYear(d2, p) { - return pad$2(1 + timeDay.count(timeYear(d2), d2), p, 3); - } - function formatMilliseconds(d2, p) { - return pad$2(d2.getMilliseconds(), p, 3); - } - function formatMicroseconds(d2, p) { - return formatMilliseconds(d2, p) + "000"; - } - function formatMonthNumber(d2, p) { - return pad$2(d2.getMonth() + 1, p, 2); - } - function formatMinutes(d2, p) { - return pad$2(d2.getMinutes(), p, 2); - } - function formatSeconds(d2, p) { - return pad$2(d2.getSeconds(), p, 2); - } - function formatWeekdayNumberMonday(d2) { - var day = d2.getDay(); - return day === 0 ? 7 : day; - } - function formatWeekNumberSunday(d2, p) { - return pad$2(timeSunday.count(timeYear(d2) - 1, d2), p, 2); - } - function dISO(d2) { - var day = d2.getDay(); - return day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2); - } - function formatWeekNumberISO(d2, p) { - d2 = dISO(d2); - return pad$2(timeThursday.count(timeYear(d2), d2) + (timeYear(d2).getDay() === 4), p, 2); - } - function formatWeekdayNumberSunday(d2) { - return d2.getDay(); - } - function formatWeekNumberMonday(d2, p) { - return pad$2(timeMonday.count(timeYear(d2) - 1, d2), p, 2); - } - function formatYear$1(d2, p) { - return pad$2(d2.getFullYear() % 100, p, 2); - } - function formatYearISO(d2, p) { - d2 = dISO(d2); - return pad$2(d2.getFullYear() % 100, p, 2); - } - function formatFullYear(d2, p) { - return pad$2(d2.getFullYear() % 1e4, p, 4); - } - function formatFullYearISO(d2, p) { - var day = d2.getDay(); - d2 = day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2); - return pad$2(d2.getFullYear() % 1e4, p, 4); - } - function formatZone(d2) { - var z2 = d2.getTimezoneOffset(); - return (z2 > 0 ? "-" : (z2 *= -1, "+")) + pad$2(z2 / 60 | 0, "0", 2) + pad$2(z2 % 60, "0", 2); - } - function formatUTCDayOfMonth(d2, p) { - return pad$2(d2.getUTCDate(), p, 2); - } - function formatUTCHour24(d2, p) { - return pad$2(d2.getUTCHours(), p, 2); - } - function formatUTCHour12(d2, p) { - return pad$2(d2.getUTCHours() % 12 || 12, p, 2); - } - function formatUTCDayOfYear(d2, p) { - return pad$2(1 + utcDay.count(utcYear(d2), d2), p, 3); - } - function formatUTCMilliseconds(d2, p) { - return pad$2(d2.getUTCMilliseconds(), p, 3); - } - function formatUTCMicroseconds(d2, p) { - return formatUTCMilliseconds(d2, p) + "000"; - } - function formatUTCMonthNumber(d2, p) { - return pad$2(d2.getUTCMonth() + 1, p, 2); - } - function formatUTCMinutes(d2, p) { - return pad$2(d2.getUTCMinutes(), p, 2); - } - function formatUTCSeconds(d2, p) { - return pad$2(d2.getUTCSeconds(), p, 2); - } - function formatUTCWeekdayNumberMonday(d2) { - var dow = d2.getUTCDay(); - return dow === 0 ? 7 : dow; - } - function formatUTCWeekNumberSunday(d2, p) { - return pad$2(utcSunday.count(utcYear(d2) - 1, d2), p, 2); - } - function UTCdISO(d2) { - var day = d2.getUTCDay(); - return day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2); - } - function formatUTCWeekNumberISO(d2, p) { - d2 = UTCdISO(d2); - return pad$2(utcThursday.count(utcYear(d2), d2) + (utcYear(d2).getUTCDay() === 4), p, 2); - } - function formatUTCWeekdayNumberSunday(d2) { - return d2.getUTCDay(); - } - function formatUTCWeekNumberMonday(d2, p) { - return pad$2(utcMonday.count(utcYear(d2) - 1, d2), p, 2); - } - function formatUTCYear(d2, p) { - return pad$2(d2.getUTCFullYear() % 100, p, 2); - } - function formatUTCYearISO(d2, p) { - d2 = UTCdISO(d2); - return pad$2(d2.getUTCFullYear() % 100, p, 2); - } - function formatUTCFullYear(d2, p) { - return pad$2(d2.getUTCFullYear() % 1e4, p, 4); - } - function formatUTCFullYearISO(d2, p) { - var day = d2.getUTCDay(); - d2 = day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2); - return pad$2(d2.getUTCFullYear() % 1e4, p, 4); - } - function formatUTCZone() { - return "+0000"; - } - function formatLiteralPercent() { - return "%"; - } - function formatUnixTimestamp(d2) { - return +d2; - } - function formatUnixTimestampSeconds(d2) { - return Math.floor(+d2 / 1e3); - } - var locale$2; - var timeFormat$1; - var timeParse$1; - var utcFormat$1; - var utcParse$1; - defaultLocale$2({ - dateTime: "%x, %X", - date: "%-m/%-d/%Y", - time: "%-I:%M:%S %p", - periods: ["AM", "PM"], - days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], - shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], - shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] - }); - function defaultLocale$2(definition2) { - locale$2 = formatLocale$1(definition2); - timeFormat$1 = locale$2.format; - timeParse$1 = locale$2.parse; - utcFormat$1 = locale$2.utcFormat; - utcParse$1 = locale$2.utcParse; - return locale$2; - } - function date(t) { - return new Date(t); - } - function number$4(t) { - return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t); - } - function calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2) { - var scale2 = continuous$1(), invert2 = scale2.invert, domain2 = scale2.domain; - var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear2 = format2("%Y"); - function tickFormat2(date2) { - return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week2(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2); - } - scale2.invert = function(y2) { - return new Date(invert2(y2)); - }; - scale2.domain = function(_) { - return arguments.length ? domain2(Array.from(_, number$4)) : domain2().map(date); - }; - scale2.ticks = function(interval2) { - var d2 = domain2(); - return ticks2(d2[0], d2[d2.length - 1], interval2 == null ? 10 : interval2); - }; - scale2.tickFormat = function(count2, specifier) { - return specifier == null ? tickFormat2 : format2(specifier); - }; - scale2.nice = function(interval2) { - var d2 = domain2(); - if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval(d2[0], d2[d2.length - 1], interval2 == null ? 10 : interval2); - return interval2 ? domain2(nice(d2, interval2)) : scale2; - }; - scale2.copy = function() { - return copy$2(scale2, calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2)); - }; - return scale2; - } - function time$1() { - return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat$1).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); - } - function utcTime() { - return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat$1).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); - } - function transformer$2() { - var x02 = 0, x12 = 1, t02, t12, k10, transform2, interpolator = identity$6, clamp2 = false, unknown; - function scale2(x2) { - return x2 == null || isNaN(x2 = +x2) ? unknown : interpolator(k10 === 0 ? 0.5 : (x2 = (transform2(x2) - t02) * k10, clamp2 ? Math.max(0, Math.min(1, x2)) : x2)); - } - scale2.domain = function(_) { - return arguments.length ? ([x02, x12] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02), scale2) : [x02, x12]; - }; - scale2.clamp = function(_) { - return arguments.length ? (clamp2 = !!_, scale2) : clamp2; - }; - scale2.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale2) : interpolator; - }; - function range2(interpolate2) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate2(r0, r1), scale2) : [interpolator(0), interpolator(1)]; - }; - } - scale2.range = range2(interpolate$1); - scale2.rangeRound = range2(interpolateRound); - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : unknown; - }; - return function(t) { - transform2 = t, t02 = t(x02), t12 = t(x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02); - return scale2; - }; - } - function copy$1(source2, target2) { - return target2.domain(source2.domain()).interpolator(source2.interpolator()).clamp(source2.clamp()).unknown(source2.unknown()); - } - function sequential() { - var scale2 = linearish(transformer$2()(identity$6)); - scale2.copy = function() { - return copy$1(scale2, sequential()); - }; - return initInterpolator.apply(scale2, arguments); - } - function sequentialLog() { - var scale2 = loggish(transformer$2()).domain([1, 10]); - scale2.copy = function() { - return copy$1(scale2, sequentialLog()).base(scale2.base()); - }; - return initInterpolator.apply(scale2, arguments); - } - function sequentialSymlog() { - var scale2 = symlogish(transformer$2()); - scale2.copy = function() { - return copy$1(scale2, sequentialSymlog()).constant(scale2.constant()); - }; - return initInterpolator.apply(scale2, arguments); - } - function sequentialPow() { - var scale2 = powish(transformer$2()); - scale2.copy = function() { - return copy$1(scale2, sequentialPow()).exponent(scale2.exponent()); - }; - return initInterpolator.apply(scale2, arguments); - } - function sequentialSqrt() { - return sequentialPow.apply(null, arguments).exponent(0.5); - } - function transformer$1() { - var x02 = 0, x12 = 0.5, x2 = 1, s2 = 1, t02, t12, t22, k10, k21, interpolator = identity$6, transform2, clamp2 = false, unknown; - function scale2(x3) { - return isNaN(x3 = +x3) ? unknown : (x3 = 0.5 + ((x3 = +transform2(x3)) - t12) * (s2 * x3 < s2 * t12 ? k10 : k21), interpolator(clamp2 ? Math.max(0, Math.min(1, x3)) : x3)); - } - scale2.domain = function(_) { - return arguments.length ? ([x02, x12, x2] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), t22 = transform2(x2 = +x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1, scale2) : [x02, x12, x2]; - }; - scale2.clamp = function(_) { - return arguments.length ? (clamp2 = !!_, scale2) : clamp2; - }; - scale2.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale2) : interpolator; - }; - function range2(interpolate2) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate2, [r0, r1, r2]), scale2) : [interpolator(0), interpolator(0.5), interpolator(1)]; - }; - } - scale2.range = range2(interpolate$1); - scale2.rangeRound = range2(interpolateRound); - scale2.unknown = function(_) { - return arguments.length ? (unknown = _, scale2) : unknown; - }; - return function(t) { - transform2 = t, t02 = t(x02), t12 = t(x12), t22 = t(x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1; - return scale2; - }; - } - function diverging$1() { - var scale2 = linearish(transformer$1()(identity$6)); - scale2.copy = function() { - return copy$1(scale2, diverging$1()); - }; - return initInterpolator.apply(scale2, arguments); - } - function divergingLog() { - var scale2 = loggish(transformer$1()).domain([0.1, 1, 10]); - scale2.copy = function() { - return copy$1(scale2, divergingLog()).base(scale2.base()); - }; - return initInterpolator.apply(scale2, arguments); - } - function divergingSymlog() { - var scale2 = symlogish(transformer$1()); - scale2.copy = function() { - return copy$1(scale2, divergingSymlog()).constant(scale2.constant()); - }; - return initInterpolator.apply(scale2, arguments); - } - function divergingPow() { - var scale2 = powish(transformer$1()); - scale2.copy = function() { - return copy$1(scale2, divergingPow()).exponent(scale2.exponent()); - }; - return initInterpolator.apply(scale2, arguments); - } - function divergingSqrt() { - return divergingPow.apply(null, arguments).exponent(0.5); - } - function assignTransitionStagger(transition, currentData, selection, presenter) { - const { layerStagger } = presenter.morphchartsref; - const { morphChartsRenderResult } = presenter; - const cubelayer = morphChartsRenderResult.getCubeLayer(); - const range2 = transition.reverse ? [1, 0] : [0, 1]; - if (!transition || transition.type === "ordinal" && !transition.reverse) { - delete layerStagger.cubes; - } else { - const staggerOrders = new Float64Array(cubelayer.positionsX.length); - switch (transition.type) { - case "ordinal": { - const scale2 = linear$1(range2).domain([0, currentData.length]); - currentData.forEach((datum2, i) => { - const glOrdinal = datum2[GL_ORDINAL]; - staggerOrders[glOrdinal] = scale2(i); - }); - break; - } - case "column": { - if (transition.column.quantitative) { - const values2 = new Float64Array(currentData.length); - currentData.forEach((datum2, i) => { - values2[i] = datum2[transition.column.name]; - }); - const stats = getStats(currentData, transition.column); - const scale2 = linear$1(range2).domain([stats.min, stats.max]); - currentData.forEach((datum2, i) => { - const glOrdinal = datum2[GL_ORDINAL]; - staggerOrders[glOrdinal] = scale2(values2[i]); - }); - } else { - const strings2 = new Array(currentData.length); - currentData.forEach((datum2, i) => { - strings2[i] = datum2[transition.column.name]; - }); - getStats(currentData, transition.column, (distictValues) => { - currentData.forEach((datum2, i) => { - const glOrdinal = datum2[GL_ORDINAL]; - const index2 = distictValues.indexOf(strings2[i]); - const staggerOrder = index2 / distictValues.length; - staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; - }); - }); - } - break; - } - case "position": { - const dimensions = { - x: cubelayer.positionsX, - y: cubelayer.positionsY, - z: cubelayer.positionsZ - }; - const positions2 = dimensions[transition.dimension]; - const values2 = new Float64Array(currentData.length); - currentData.forEach((datum2, i) => { - const glOrdinal = datum2[GL_ORDINAL]; - values2[i] = positions2[glOrdinal]; - }); - const stats = getStats(values2, null, "number", true); - const scale2 = linear$1(range2).domain([stats.min, stats.max]); - currentData.forEach((datum2, i) => { - const glOrdinal = datum2[GL_ORDINAL]; - staggerOrders[glOrdinal] = scale2(values2[i]); - }); - break; - } - } - layerStagger.cubes = { staggerOrders, maxStaggerOrder: 1, minStaggerOrder: 0 }; - } - cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); - } - var __awaiter = function(thisArg, _arguments, P, generator) { - function adopt(value2) { - return value2 instanceof P ? value2 : new P(function(resolve2) { - resolve2(value2); - }); - } - return new (P || (P = Promise))(function(resolve2, reject) { - function fulfilled(value2) { - try { - step(generator.next(value2)); - } catch (e) { - reject(e); - } - } - function rejected(value2) { - try { - step(generator["throw"](value2)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - const { defaultView } = defaults$1; - const zAxisZindex = 1010; - let didRegisterColorSchemes = false; - let Viewer$1 = class Viewer { - /** - * Instantiate a new Viewer. - * @param element Parent HTMLElement to present within. - * @param options Optional viewer options object. - */ - constructor(element2, options2) { - this.element = element2; - this.options = deepMerge(defaultViewerOptions$1, options2); - this.presenter = new Presenter(element2, getPresenterStyle(this.options)); - this._characterSet = new CharacterSet(); - this._dataScope = new DataScope$2(); - this._animator = new Animator(this._dataScope, { - onDataChanged: this.onDataChanged.bind(this), - onAnimateDataChange: this.onAnimateDataChange.bind(this) - }); - this._details = new Details(this.presenter.getElement(PresenterElement$1.panel), this.options.language, this._animator, this._dataScope, (remap) => { - this.currentColorContext = ~~remap; - this.renderSameLayout(); - }, () => this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); - this.insight = {}; - } - changeColorContexts(colorContexts) { - this.colorContexts = colorContexts; - this.currentColorContext = 0; - this.options.onColorContextChange && this.options.onColorContextChange(); - } - applyLegendColorContext(colorContext) { - const a2 = getActiveElementInfo(); - mount(colorContext.legendElement, this.presenter.getElement(PresenterElement$1.legend)); - setActiveElement(a2); - this.presenter.stage.legend = colorContext.legend; - } - onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time2) { - var _a2; - if (time2 === void 0) { - const transitionDurations = ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transitionDurations) || defaultPresenterConfig.transitionDurations; - time2 = transitionDurations.position + transitionDurations.stagger; - } - return new Promise((resolve2, reject) => { - let innerPromise; - if (dataChange === DataLayoutChange.refine) { - const oldColorContext = this.colorContexts[this.currentColorContext]; - innerPromise = new Promise((innerResolve) => { - this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { - finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - cubeLayer.unitColorMap = oldColorContext.colorMap; - if (this.options.onStage) { - this.options.onStage(stage); - } - } })).then(() => { - this.applyLegendColorContext(oldColorContext); - innerResolve(); - }); - }); - } else { - innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, colorMapper) => { - finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - if (this.options.onStage) { - this.options.onStage(stage); - } - } })); - } - innerPromise.then(() => { - this.presenter.animationQueue(resolve2, time2, { waitingLabel, handlerLabel, animationCanceled: reject }); - }); - }); - } - onDataChanged(dataLayout, filter2) { - return __awaiter(this, void 0, void 0, function* () { - switch (dataLayout) { - case DataLayoutChange.same: { - const hasSelectedData = this._dataScope.hasSelectedData(); - const hasActive = !!this._dataScope.active; - if (hasSelectedData || hasActive) { - this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); - } else { - this.presenter.morphChartsRenderResult.update({ cubes: null }); - } - break; - } - case DataLayoutChange.refine: { - const oldColorContext = this.colorContexts[this.currentColorContext]; - let colorMap; - this.presenter.morphChartsRenderResult.update({ cubes: null }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { - colorMap = cubeLayer.unitColorMap; - cubeLayer.unitColorMap = oldColorContext.colorMap; - this.preStage(stage, cubeLayer); - }, onPresent: () => { - const newColorContext = { - colorMap, - legend: clone(this.presenter.stage.legend), - legendElement: this.presenter.getElement(PresenterElement$1.legend).children[0] - }; - this.applyLegendColorContext(oldColorContext); - this.changeColorContexts([oldColorContext, newColorContext]); - this.onPresent(); - } })); - if (!compare$4(this.insight.filter, filter2)) { - this.insight.filter = narrow(this.insight.filter, filter2); - } - if (this.options.onDataFilter) { - this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); - } - break; - } - case DataLayoutChange.reset: { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - this.changeColorContexts([colorContext]); - this.presenter.morphChartsRenderResult.update({ cubes: null }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { onPresent: () => { - populateColorContext(colorContext, this.presenter); - this.onPresent(); - } })); - delete this.insight.filter; - if (this.options.onDataFilter) { - this.options.onDataFilter(null, null); - } - break; - } - } - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); - } - }); - } - convertSearchToSet() { - if (this._dataScope.selection) { - const s2 = /* @__PURE__ */ new Set(); - let found = false; - this._dataScope.selection.included.forEach((o, i) => { - s2.add(o[GL_ORDINAL]); - found = true; - }); - if (!found) { - s2.add(-1); - } - return s2; - } - } - convertSetToSearch(s2) { - const search = { - expressions: [] - }; - s2.forEach((value2) => { - search.expressions.push({ - name: GL_ORDINAL, - operator: "==", - value: value2, - clause: "||" - }); - }); - return search; - } - getSpecColumnsWithFilteredStats() { - if (!this._dataScope.hasFilteredData()) { - return this._specColumns; - } - const roles = ["color", "facet", "group", "size", "sort", "sum", "x", "y", "z"]; - const specColumns = Object.assign({}, this._specColumns); - roles.forEach((r) => { - if (specColumns[r]) { - const column = Object.assign({}, specColumns[r]); - column.stats = this.getColumnStats(column); - specColumns[r] = column; - } - }); - return specColumns; - } - renderNewLayout(signalValues, presenterConfig, view) { - return __awaiter(this, void 0, void 0, function* () { - const currData = this._dataScope.currentData(); - const context2 = { - specColumns: this.getSpecColumnsWithFilteredStats(), - insight: this.insight, - specViewOptions: Object.assign(Object.assign({}, this.options), { zAxisOptions: { - showZAxis: true, - zIndex: zAxisZindex - }, collapseFacetAxes: true }) - }; - const specResult = build(context2, currData); - if (!specResult.errors) { - const uiValues = extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); - applySignalValues(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); - unbindSignalUI(specResult.vegaSpec); - this.vegaSpec = specResult.vegaSpec; - this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); - this.specCapabilities = specResult.specCapabilities; - const config = this.createConfig(presenterConfig); - this._lastPresenterConfig = config.presenterConfig; - if (view) { - config.getView = () => view; - } - if (!didRegisterColorSchemes) { - registerColorSchemes(base$3.vega); - didRegisterColorSchemes = true; - } - try { - if (this.vegaViewGl) { - this.vegaViewGl.finalize(); - } - const runtime2 = base$3.vega.parse(this.vegaSpec); - this.vegaViewGl = new ViewGl(runtime2, config).renderer("morphcharts").initialize(this.element); - yield this.vegaViewGl.runAsync(); - const handler = (n, v) => { - this._characterSet.resetCharacterSet(true); - }; - this.vegaSpec.signals.forEach((s2) => { - this.vegaViewGl.addSignalListener(s2.name, handler); - }); - this.configForSignalCapture(config.presenterConfig); - } catch (e) { - specResult.errors = [e.message]; - } - if (!specResult.errors) { - ensureHeaders(this.presenter, this.options.language.headers); - } - } - if (specResult.errors) { - if (this.options.onError) { - this.options.onError(specResult.errors); - } else if (this.presenter.logger) { - this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join("\n")}`); - } - } - return specResult; - }); - } - /** - * Render the same layout with new options. - * @param newViewerOptions New options object. - */ - renderSameLayout(newViewerOptions) { - const colorContext = this.colorContexts[this.currentColorContext]; - this.applyLegendColorContext(colorContext); - if (newViewerOptions) { - if (newViewerOptions.colors) { - const mcColors = this.getMorphChartsColors(); - this.presenter.configColors(mcColors); - this._lastPresenterConfig.morphChartsColors = mcColors; - } - this.options = deepMerge(this.options, newViewerOptions); - } - this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; - this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); - } - getView(view) { - if (view === void 0) { - if (this.presenter.view === null) { - return defaultView; - } else { - return this.presenter.view; - } - } else { - return view; - } - } - transformData(values2, transform2) { - try { - const runtime2 = base$3.vega.parse({ - $schema: "https://vega.github.io/schema/vega/v4.json", - data: [{ - name: "source", - values: values2, - transform: transform2 - }] - }); - new ViewGl(runtime2).run(); - } catch (e) { - } - return values2; - } - /** - * Render data into a visualization. - * @param insightSetup InsightSetup object to create a visualization rendering. - * @param data Array of data objects. - * @param renderOptions Optional RenderOptions object. - */ - render(insightSetup_1, data_1) { - return __awaiter(this, arguments, void 0, function* (insightSetup, data2, renderOptions = {}) { - const { insight, setup: setup2 } = insightSetup; - let result; - if (!compare$4(insight.filter, this.insight.filter)) { - const transitionDurations = (setup2 === null || setup2 === void 0 ? void 0 : setup2.transitionDurations) || defaultPresenterConfig.transitionDurations; - const renderTime = transitionDurations.position + transitionDurations.stagger; - const allowAsyncRenderTime = renderTime + this.options.filterRenderingTimerPadding; - if (insight.filter) { - result = yield this._render(insightSetup, data2, renderOptions, true); - this.presenter.animationQueue(() => { - this.filter(insight.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); - }, allowAsyncRenderTime, { waitingLabel: "layout before refine", handlerLabel: "refine after layout" }); - } else { - this._dataScope.setFilteredData(null); - result = yield this._render(insightSetup, data2, renderOptions, true); - this.presenter.animationQueue(() => { - this.reset(); - }, allowAsyncRenderTime, { waitingLabel: "layout before reset", handlerLabel: "reset after layout" }); - } - } else { - result = yield this._render(insightSetup, data2, renderOptions, false); - } - return result; - }); - } - shouldViewstateTransition(newInsight, oldInsight) { - if (!oldInsight.columns) - return false; - if (oldInsight.chart !== newInsight.chart) - return true; - if (oldInsight.size.height !== newInsight.size.height) - return true; - if (oldInsight.size.width !== newInsight.size.width) - return true; - if (oldInsight.columns.facet !== newInsight.columns.facet) - return true; - return false; - } - configForSignalCapture(presenterConfig) { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - presenterConfig.preStage = (stage, cubeLayer) => { - if (this._shouldSaveColorContext()) { - colorContext.colorMap = cubeLayer.unitColorMap; - } - this.preStage(stage, cubeLayer); - }; - presenterConfig.onPresent = () => { - if (this._shouldSaveColorContext()) { - populateColorContext(colorContext, this.presenter); - this.changeColorContexts([colorContext]); - this._dataScope.deselect(); - } - this.onPresent(); - }; - } - onPresent() { - var _a2; - if ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transition) { - assignTransitionStagger(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); - } - this.options.onPresent && this.options.onPresent(); - } - _render(insightSetup, data2, renderOptions, forceNewCharacterSet) { - return __awaiter(this, void 0, void 0, function* () { - const { insight, setup: setup2 } = insightSetup; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (this._dataScope.setData(data2, renderOptions.columns)) { - this.transformData(data2, insight.transform); - } - this._specColumns = getSpecColumns(insight, this._dataScope.getColumns(renderOptions.columnTypes)); - const ordinalMap = assignOrdinals(this._specColumns, data2, renderOptions.ordinalMap); - this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight); - this.insight = clone(insight); - this.setup = setup2; - this._shouldSaveColorContext = () => !renderOptions.initialColorContext; - const colorContext = renderOptions.initialColorContext || { - colorMap: null, - legend: null, - legendElement: null - }; - const specResult = yield this.renderNewLayout(insight.signalValues, Object.assign(Object.assign({}, setup2 || {}), { preStage: (stage, cubeLayer) => { - if (this._shouldSaveColorContext()) { - colorContext.colorMap = cubeLayer.unitColorMap; - } else { - cubeLayer.unitColorMap = colorContext.colorMap; - } - const hasSelectedData = !!this._dataScope.hasSelectedData(); - if (hasSelectedData || this._dataScope.active) ; - this.preStage(stage, cubeLayer); - }, onPresent: () => { - if (this._shouldSaveColorContext()) { - populateColorContext(colorContext, this.presenter); - this.changeColorContexts([colorContext]); - } else { - this.applyLegendColorContext(colorContext); - } - this.onPresent(); - }, shouldViewstateTransition: () => this.shouldViewstateTransition(insight, this.insight) }), this.getView(insight.view)); - this._shouldSaveColorContext = () => !renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); - this._details.render(); - const result = { ordinalMap, specResult }; - return result; - }); - } - overrideAxisLabels(stage) { - } - preLayer(stage) { - let axisRole; - for (axisRole in stage.axes) { - const capability = this.specCapabilities.roles.filter((r) => r.role === axisRole)[0]; - if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === "exact")) { - moveTicksBetween(stage.axes[axisRole]); - } - } - } - preStage(stage, cubeLayer) { - this.overrideAxisLabels(stage); - this._axisSelection = new AxisSelection(this.specCapabilities, this._specColumns, stage); - finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - if (this.options.onStage) { - this.options.onStage(stage); - } - } - onCubeClick(e, cube) { - this.options.onCubeClick && this.options.onCubeClick(e, cube); - const hasSelectedData = this._dataScope.hasSelectedData(); - if (hasSelectedData && this._dataScope.selection.included.length > 1) { - const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); - if (indexWithinSelection.index >= 0) { - this.activate(indexWithinSelection.datum); - this._details.populate(this._dataScope.selection, indexWithinSelection.index); - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); - } - return; - } - } - if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][GL_ORDINAL] === cube.ordinal) { - this.deselect(); - return; - } - const search = { - name: GL_ORDINAL, - operator: "==", - value: cube.ordinal - }; - this.select(search); - } - onCubeHover(event2, cube) { - var _a2, _b2; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (!cube) { - return; - } - const currentData = this._dataScope.currentData(); - const index2 = getDataIndexOfCube(cube, currentData); - if (index2 >= 0) { - const dataItem = cleanDataItem(((_a2 = this.options.tooltipOptions) === null || _a2 === void 0 ? void 0 : _a2.prepareDataItem(currentData[index2])) || currentData[index2]); - const tooltipCreateOptions = { - dataItem, - event: event2 - }; - if ((_b2 = this.options.tooltipOptions) === null || _b2 === void 0 ? void 0 : _b2.create) { - this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); - } else { - this._tooltip = new Tooltip$1(Object.assign(Object.assign({}, tooltipCreateOptions), { cssPrefix: this.presenter.style.cssPrefix })); - } - } - } - onTextHover(e, t) { - if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) - return false; - return !colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); - } - getMorphChartsColors() { - const { colors: colors2 } = this.options; - return { - activeItemColor: colors2.activeCube, - axesGridBackgroundColor: colors2.backgroundColor, - axesGridHighlightColor: colors2.axisSelectHighlight, - axesGridMajorColor: colors2.gridLine, - axesGridMinorColor: colors2.gridLine, - axesGridZeroColor: colors2.gridLine, - axesTextHeadingColor: colors2.axisText, - axesTextLabelColor: colors2.axisText, - axesTextTitleColor: colors2.axisText, - backgroundColor: colors2.backgroundColor, - textBorderColor: colors2.backgroundColor, - textColor: colors2.axisText - }; - } - createConfig(c2) { - var _a2; - const { getTextColor, getTextHighlightColor, onTextClick } = this.options; - const defaultPresenterConfig2 = { - morphChartsColors: this.getMorphChartsColors(), - zAxisZindex, - getCharacterSet: (stage) => this._characterSet.getCharacterSet(stage), - getTextColor, - getTextHighlightColor, - onTextClick: (e, t) => { - if (t.metaData && t.metaData.search) { - const search = getSearchGroupFromVegaValue(t.metaData.search); - if (this.options.onAxisClick) { - this.options.onAxisClick(e, search); - } else { - this.select(search); - } - } - if (onTextClick) { - onTextClick(e, t); - } - }, - onCubeClick: this.onCubeClick.bind(this), - onCubeHover: this.onCubeHover.bind(this), - onTextHover: this.onTextHover.bind(this), - preLayer: this.preLayer.bind(this), - preStage: this.preStage.bind(this), - onPresent: this.onPresent.bind(this), - onAxisConfig: (cartesian2, dim3d, axis) => { - if (!axis) - return; - const role = this.specCapabilities.roles.filter((r) => r.role === axis.axisRole)[0]; - if (role === null || role === void 0 ? void 0 : role.axisSelection) { - cartesian2.isDivisionPickingEnabled[dim3d] = true; - cartesian2.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; - cartesian2.isLabelPickingEnabled[dim3d] = true; - cartesian2.isTitlePickingEnabled[dim3d] = true; - cartesian2.isHeadingPickingEnabled[dim3d] = true; - cartesian2.isGridPickingEnabled = false; - } - }, - onAxesComplete: (cartesian2) => { - }, - axisPickGridCallback: (divisions, e) => { - const search = this._axisSelection.convert(divisions); - if (this.options.onAxisClick) { - this.options.onAxisClick(e, search); - } else { - this.select(search); - } - }, - onLayerClick: (e) => { - this.options.onCanvasClick && this.options.onCanvasClick(e); - this.deselect(); - }, - onLegendClick: (e, legend2, clickedIndex) => { - const legendRow = clickedIndex !== null && legend2.rows[clickedIndex]; - if (legendRow) { - if (this.options.onLegendRowClick) { - this.options.onLegendRowClick(e, legendRow); - } else { - this.select(legendRow.search); - } - } else if (this.options.onLegendHeaderClick) { - this.options.onLegendHeaderClick(e); - } - }, - onSceneRectAssignCubeOrdinal: (datum2) => { - return datum2[GL_ORDINAL]; - }, - onTargetViewState: (h2, w2) => { - const { height: height2, width: width2 } = this.insight.size; - let newViewStateTarget; - if (this.options.onNewViewStateTarget) { - newViewStateTarget = this.options.onNewViewStateTarget(); - } - return { height: height2, width: width2, newViewStateTarget }; - }, - layerSelection: { - cubes: this.convertSearchToSet() - }, - preserveDrawingBuffer: this.options.preserveDrawingBuffer - }; - if (!this.options.disableLasso) { - defaultPresenterConfig2.onLasso = (ids, e) => { - this.deselect(); - const search = this.convertSetToSearch(ids); - this.select(search); - }; - } - if (this.options.onBeforeCreateLayers) { - defaultPresenterConfig2.preLayer = (stage) => { - this.preLayer(stage); - this.options.onBeforeCreateLayers(stage, this.specCapabilities); - }; - } - const config = { - presenter: this.presenter, - presenterConfig: Object.assign(defaultPresenterConfig2, c2) - }; - if ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transitionDurations) { - config.presenterConfig.transitionDurations = this.setup.transitionDurations; - } - return config; - } - /** - * Filter the data and animate. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. - */ - filter(search, rebase = false) { - const u2 = this._dataScope.createUserSelection(search, false, rebase); - return new Promise((resolve2, reject) => { - this._animator.filter(search, u2.included, u2.excluded, rebase).then(() => { - this._details.clear(); - this._details.clearSelection(); - this._details.populate(this._dataScope.selection); - resolve2(); - }); - }); - } - /** - * Remove any filtration and animate. - */ - reset() { - return new Promise((resolve2, reject) => { - this._animator.reset().then(() => { - this._details.clear(); - this._details.clearSelection(); - resolve2(); - }); - }); - } - /** - * Select cubes by a filter expression. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - */ - select(search) { - return new Promise((resolve2, reject) => { - this._animator.select(search).then(() => { - this._details.populate(this._dataScope.selection); - resolve2(); - }); - }); - } - /** - * Removes any selection. - */ - deselect() { - return new Promise((resolve2, reject) => { - this._animator.deselect().then(() => { - this._details.clearSelection(); - resolve2(); - }); - }); - } - /** - * Gets the current selection. - */ - getSelection() { - if (!this._dataScope) - return null; - const selectionState = { - search: this._dataScope.selection && this._dataScope.selection.search || null, - selectedData: this._dataScope.selection && this._dataScope.selection.included || null, - active: this._dataScope.active - }; - return selectionState; - } - /** - * Set one data row to the active state. - */ - activate(datum2) { - return new Promise((resolve2, reject) => { - this._animator.activate(datum2).then(() => { - this.presenter.morphChartsRenderResult.activate(datum2[GL_ORDINAL]); - this._details.render(); - resolve2(); - }); - }); - } - /** - * Deactivate item. - */ - deActivate() { - return new Promise((resolve2, reject) => { - if (this._dataScope && this._dataScope.active) { - this._animator.deactivate().then(() => { - this.presenter.morphChartsRenderResult.activate(-1); - this._details.render(); - resolve2(); - }); - } else { - resolve2(); - } - }); - } - /** - * Gets the current camera. - * @param transitionFinal Optional flag to get camera destination when transition completes. - */ - getCamera(transitionFinal = false) { - var _a2, _b2, _c2, _d2, _e2, _f, _g; - let position2 = [0, 0, 0]; - let rotation2 = [0, 0, 0, 0]; - if (transitionFinal) { - position2 = Array.from((_b2 = (_a2 = this.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphchartsref) === null || _b2 === void 0 ? void 0 : _b2.cameraTransitioner.vPosition.to); - rotation2 = Array.from((_d2 = (_c2 = this.presenter) === null || _c2 === void 0 ? void 0 : _c2.morphchartsref) === null || _d2 === void 0 ? void 0 : _d2.cameraTransitioner.qRotation.to); - } else { - const camera = (_g = (_f = (_e2 = this.presenter) === null || _e2 === void 0 ? void 0 : _e2.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; - if (camera) { - camera.getPosition(position2); - camera.getOrbit(rotation2); - } - } - return { position: position2, rotation: rotation2, captureSize: this.insight.size }; - } - /** - * Sets the current camera. - * @param camera Camera to set. - */ - setCamera(camera) { - var _a2, _b2; - if (camera) { - (_b2 = (_a2 = this.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphChartsRenderResult) === null || _b2 === void 0 ? void 0 : _b2.moveCamera(camera); - } - } - /** - * Gets the current insight with signal values. - */ - getInsight() { - const insight = Object.assign({}, this.insight); - insight.signalValues = this.getSignalValues(); - return insight; - } - /** - * Gets column stats from current data (filtered or all). - * @param column Column to get stats for. - */ - getColumnStats(column) { - return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; - } - /** - * Gets current signal values. - */ - getSignalValues() { - return extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); - } - assignTransitionStagger(transition) { - assignTransitionStagger(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); - } - finalize() { - if (this._dataScope) - this._dataScope.finalize(); - if (this._details) - this._details.finalize(); - if (this._tooltip) - this._tooltip.destroy(); - if (this.vegaViewGl) - this.vegaViewGl.finalize(); - if (this.presenter) - this.presenter.finalize(); - if (this.element) - this.element.innerHTML = ""; - this.colorContexts = null; - this.element = null; - this.options = null; - this.presenter = null; - this.vegaSpec = null; - this.vegaViewGl = null; - this._animator = null; - this._dataScope = null; - this._details = null; - this._tooltip = null; - } - }; - Viewer$1.defaultViewerOptions = defaultViewerOptions$1; - const version$4 = "4.0.6"; - const use$4 = use$5; - const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - VegaMorphCharts: index$5, - Viewer: Viewer$1, - colorSchemes, - constants: constants$1, - searchExpression: index$6, - specs: index$7, - types: types$1, - use: use$4, - util: util$3, - version: version$4 - }, Symbol.toStringTag, { value: "Module" })); - var collectionCompare = compare$2; - function compare$2(value1, value2) { - if (value1 === value2) { - return true; - } - if (value1 !== value1 && value2 !== value2) { - return true; - } - if ({}.toString.call(value1) != {}.toString.call(value2)) { - return false; - } - if (value1 !== Object(value1)) { - return false; - } - if (!value1) { - return false; - } - if (Array.isArray(value1)) { - return compareArrays(value1, value2); - } - if ({}.toString.call(value1) == "[object Set]") { - return compareArrays(Array.from(value1), Array.from(value2)); - } - if ({}.toString.call(value1) == "[object Object]") { - return compareObjects(value1, value2); - } else { - return compareNativeSubtypes(value1, value2); - } - } - function compareNativeSubtypes(value1, value2) { - return value1.toString() === value2.toString(); - } - function compareArrays(value1, value2) { - var len2 = value1.length; - if (len2 != value2.length) { - return false; - } - var alike = true; - for (var i = 0; i < len2; i++) { - if (!compare$2(value1[i], value2[i])) { - alike = false; - break; - } - } - return alike; - } - function compareObjects(value1, value2) { - var keys1 = Object.keys(value1).sort(); - var keys2 = Object.keys(value2).sort(); - var len2 = keys1.length; - if (len2 != keys2.length) { - return false; - } - for (var i = 0; i < len2; i++) { - var key1 = keys1[i]; - var key2 = keys2[i]; - if (!(key1 == key2 && compare$2(value1[key1], value2[key2]))) { - return false; - } - } - return true; - } - const compare$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - default: collectionCompare - }, Symbol.toStringTag, { value: "Module" })); - const classList = (...args) => { - return args.filter(Boolean).join(" "); - }; - const deepCompare = collectionCompare || compare$3; - function addNullable(insight, signalValues) { - const withNulls = Object.assign(Object.assign({ view: null, filter: null }, insight), { signalValues }); - return withNulls; - } - function compareInsight(viewer, insight) { - const currentInsight = viewer.getInsight(); - const a2 = addNullable(currentInsight, Object.assign(Object.assign({}, viewer.insight.signalValues), currentInsight.signalValues)); - const b2 = addNullable(insight, Object.assign(Object.assign({}, a2.signalValues), insight.signalValues)); - const compare2 = deepCompare(a2, b2); - return { a: a2, b: b2, compare: compare2 }; - } - const util$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - classList, - compareInsight, - deepCompare - }, Symbol.toStringTag, { value: "Module" })); - const base$2 = { - react: null, - reactDOM: null - }; - function use$3(react, reactDOM, vega2) { - use$5(vega2); - base$2.react = react; - base$2.reactDOM = reactDOM; - Viewer.prototype = react.Component.prototype; - } - function _Viewer(_props) { - class __Viewer extends base$2.react.Component { - layout() { - const { props } = this; - this.lastData = props.data; - this.viewer.render({ - insight: props.insight, - setup: props.setup - }, props.data, props.renderOptions).then((renderResult) => { - props.onView && props.onView(renderResult); - }).catch((e) => { - props.onError && props.onError(e); - }); - } - view() { - var _a2, _b2, _c2, _d2, _e2; - const { props } = this; - let didLayout = false; - if (props.insight && props.data) { - const c2 = compareInsight(this.viewer, props.insight); - const sameDataRef = props.data === this.lastData; - if (!c2.compare || !sameDataRef) { - this.layout(); - didLayout = true; - } - } - if (!didLayout && props.setup) { - const { camera } = props.setup; - if (camera !== "hold") { - if (!deepCompare(this.viewer.setup.camera, camera)) { - if (!camera) { - (_b2 = (_a2 = this.viewer) === null || _a2 === void 0 ? void 0 : _a2.presenter) === null || _b2 === void 0 ? void 0 : _b2.homeCamera(); - } else { - this.viewer.setCamera(camera); - } - const setup2 = clone(this.viewer.setup); - setup2.camera = camera; - this.viewer.setup = setup2; - } - } - if (props.setup.renderer) { - (_e2 = (_d2 = (_c2 = this.viewer) === null || _c2 === void 0 ? void 0 : _c2.presenter) === null || _d2 === void 0 ? void 0 : _d2.morphchartsref) === null || _e2 === void 0 ? void 0 : _e2.setMorphChartsRendererOptions(props.setup.renderer); - } - } - } - componentDidMount() { - const { props } = this; - const element2 = base$2.reactDOM.findDOMNode(this.viewerDiv); - this.viewer = new Viewer$1(element2, props.viewerOptions); - if (props.onMount) { - if (props.onMount(this.viewer.presenter.getElement(PresenterElement$1.gl))) { - this.view(); - } - } else { - this.view(); - } - } - componentDidUpdate() { - const { props } = this; - this.viewer.options = deepMerge(this.viewer.options, props.viewerOptions); - this.view(); - } - componentWillUnmount() { - this.viewer.finalize(); - } - render() { - return base$2.react.createElement("div", { className: "sanddance-ReactViewer", ref: (div) => this.viewerDiv = div }); - } - } - return new __Viewer(_props); - } - const Viewer = _Viewer; - const version$3 = "4.0.2"; - const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - SandDance: index$4, - Viewer, - use: use$3, - util: util$2, - version: version$3 - }, Symbol.toStringTag, { value: "Module" })); - const strings$1 = { - appName: "SandDance", - bingsearch: "Bing", - bingsearchDescription: (term) => `Search Bing for "${term}"`, - buttonClose: "Close", - buttonSelect: "Search & Select", - buttonColorSchemeMap: "Map color scheme to filtered data", - buttonColorSchemeRemap: "Remap color to filtered data", - buttonColorSchemeKeep: "Keep same color scheme", - buttonCopyToClipboard: "Copy to clipboard", - buttonExclude: "Exclude", - buttonExport: "Export", - buttonExportCount: (total) => total == 1 ? "Export 1 row..." : `Export ${total} rows...`, - buttonIsolate: "Isolate", - buttonReset: "Stop filtering", - buttonDeselect: "Clear selection", - buttonToolbarFloat: "Float toolbar", - buttonToolbarDock: "Dock toolbar", - buttonToolbarHide: "Hide toolbar", - buttonToolbarShow: "Show toolbar", - buttonNextDataItem: "Next data item", - buttonPrevDataItem: "Previous data item", - buttonCreateSnapshot: "Create snapshot", - buttonNextSnapshot: "Next snapshot", - buttonPrevSnapshot: "Previous snapshot", - buttonUpdateSnapshot: "Update snapshot", - buttonAddExpression: "Add expression", - buttonAddExpressionGroup: "Add group", - buttonDeleteExpression: "Delete", - buttonDeleteExpressionGroup: "Delete group", - buttonClearSnapshots: "Clear snapshots", - buttonDeleteSnapshot: "Delete snapshot", - buttonEditSnapshot: "Edit snapshot", - buttonMoveUp: "Move up", - buttonMoveDown: "Move down", - buttonShowVegaSpec: "Show Vega spec", - buttonLaunchVegaEditor: "Open Vega Editor", - buttonCameraHome: "Center chart in window", - buttonTooltipMapping: "Tooltip columns...", - buttonBackgroundImage: "Background image...", - buttonTransitionReverse: "Play Reverse", - buttonTransitionPause: "Pause", - buttonTransitionPlay: "Play", - buttonUndo: "Undo", - buttonRedo: "Redo", - buttonColumnTypes: "Column types...", - buttonApply: "Apply", - buttonRemove: "Remove", - buttonResetToDefault: "Reset to default", - chartTypeBarChartH: "Bar", - chartTypeBarChartV: "Column", - chartTypeDensity: "Density", - chartTypeGrid: "Grid", - chartTypeScatterPlot: "Scatter", - chartTypeStacks: "Stacks", - chartTypeStrips: "Strips", - chartTypeTreeMap: "Treemap", - defaultFileName: "sanddance-data", - errorExportFilenameEmpty: "Filename cannot be blank", - errorExportFilenameCharacters: (characters) => `A filename cannot contain any of the following characters: ${characters}`, - errorColumnMustBeNumeric: "Numeric column required for this chart type.", - errorNumericValue: "Value must be numeric", - errorImageFormat: "File is not an image", - labelBackgroundImageDialogTitle: "Background image", - labelBackgroundImageSubtext: "Background image can only be shown on Scatterplot, Density, and Stacks charts. Columns must be numeric type.", - labelBackgroundLeft: "Left extent", - labelBackgroundRight: "Right extent", - labelBackgroundBottom: "Bottom extent", - labelBackgroundTop: "Top extent", - labelBlank: "blank", - labelNull: "null", - labelTrue: "true", - labelFalse: "false", - labelSystemInfo: "System info", - labelChangeColumnType: "Change column type", - labelChartSettings: "Chart settings", - labelEditColumn: "Edit", - labelColumnName: "Column name", - labelColumnType: "Column type", - labelColumnDistinct: "Distinct values", - labelColumnHasColorData: "Has color data", - labelColumnIsColorData: "Is color data", - labelColumnQuantitativeMin: "Min", - labelColumnQuantitativeMax: "Max", - labelColumnQuantitativeMean: "Mean", - labelDataBrowser: "Data browser", - labelDataScope: "Scope", - labelExport: "Export Data", - labelExportFormat: "File format", - labelExportCSV: ".CSV - Comma separated values", - labelExportHTML: ".HTML - A SandDance html page embedding this data", - labelExportJSON: ".JSON - JavaScript object notation", - labelExportTSV: ".TSV - Tab separated values", - labelHistory: "History", - labelHistoryWarning: "This will erase your current history.", - labelTools: "Tools", - labelHoldCamera: "Keep previous camera position", - labelVegaSpec: "Vega specification", - labelColor: "Chart color", - labelError: "Error", - labelExportFileName: "File name", - labelSnapshots: "Snapshots", - labelSnapshotSettingThumbnailWidth: "Thumbnail image width", - labelSearch: "Select by search", - labelSearchClause: "Clause", - labelSearchColumn: "Field", - labelSearchOperator: "Operator", - labelSearchValue: "Value", - labelSearchValuePlaceholder: "Value to search for", - labelChart: "Chart", - labelChartCanvas: "Chart canvas", - labelColumnMapping: "Column Mapping", - labelChartTypeOptions: "Chart options", - labelColorBin: "Color binning", - labelColorOptions: "Color options", - labelColorBinExplanation: "For numeric columns", - labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount) => `Field ${colorColumnName} is of type ${colorColumnType}${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ""}.`, - labelColorFieldIsColorData: (colorColumnName) => `Field ${colorColumnName} contains direct color data.`, - labelColorBinNone: "None (continuous)", - labelColorBinQuantize: "Quantize", - labelColorBinQuantile: "Quantile", - labelColorFilter: "Note: Colors will be re-mapped to the filter when viewing this snapshot.", - labelColorScheme: "Scheme", - labelTotal: "Total by", - labelTotalByCountSquare: "Count (Grid layout)", - labelTotalByCountStrip: "Count (Strip layout)", - labelTotalBySumStrip: "Sum (Strip layout)", - labelTotalBySumTreemap: "Sum (Treemap layout)", - labelTotalBySumStripPercent: "Sum as percentage (Strip layout)", - labelColumnColor: "Color by", - labelColumnFacet: "Facet by", - labelFacetLayout: "Facet layout", - labelFacetLayoutWrap: "Wrap", - // labelFacetLayoutHorizontal: 'Horizontal', - // labelFacetLayoutVertical: 'Vertical', - labelFacetLayoutCross: "⊞", - labelColumnFacetV: "Cross facet by", - labelColumnSort: "Sort by", - labelColumnX: "X Axis", - labelColumnY: "Y Axis", - labelColumnZ: "Z Axis", - labelColumnSize: "Size by", - labelColumnGroup: "Group by", - labelAliasColor: "Color", - labelAliasFacet: "Facet", - labelAliasFacetV: "Vertical facet", - labelAliasSort: "Sort", - labelAliasX: "X Axis", - labelAliasY: "Y Axis", - labelAliasZ: "Z Axis", - labelAliasSize: "Size", - labelAliasGroup: "Group", - labelDataItemIsFiltered: "Item is filtered from view", - labelHistoryInit: "Initial view", - labelHistoryFilterClear: "Clear filter", - labelHistoryFilterIExclude: "Exclude filter", - labelHistoryFilterIsolate: "Isolate filter", - labelHistoryChangeChartType: (chart) => `Change chart type to ${chart}`, - labelHistoryMapColumn: (column) => `Map ${column} role`, - labelHistoryUnMapColumn: (column) => `Unmap ${column} role`, - labelHistoryReviveSnapshot: "Revive snapshot", - labelHistoryColorBin: "Change color binning", - labelHistoryDirectColor: "Change direct color", - labelRenderer: "Renderer quality", - labelRendererAdvancedDisabled: "Renderer quality (Enhanced 3D mode not supported on this device)", - labelRendererBasic: "Standard mode", - labelRendererAdvanced: "Enhanced 3D mode", - labelRendererOptions: "Renderer options ...", - labelRendererOptionsDialogTitle: "Renderer options", - labelRendererOptionsAntialias: "Antialias", - labelRendererOptionsBloom: "Bloom highlighting (for selections)", - labelRendererOptionsBloomIntensity: "Intensity", - labelRendererOptionsDof: "Depth of Field", - labelRendererOptionsDofRange: "Focus Range", - labelRendererOptionsFxaa: "Antialias", - labelRendererOptionsShadow: "Shadows", - labelRendererOptionsSsao: "Screen Space Ambient Occlusion", - labelShowLegend: "Show legend", - labelShowAxes: "Show axes", - labelSnapshotTitle: "Title", - labelSnapshotDescription: "Note (optional)", - labelTooltipMapping: "Tooltip columns", - labelTransition: "Transition", - labelTransitionOptions: "Transition options", - labelTransitionScrubber: "Scrub transition", - labelTransitionStaggerBy: "Stagger by", - labelTransitionStaggerByOrdinal: "Data order", - labelTransitionStaggerByColumn: "Column", - labelTransitionStaggerByPosition: "Axis position", - labelTransitionStaggerOptions: "Stagger options", - labelTransitionStaggerReverse: "Reverse", - labelTransitionDurations: "Transition durations", - labelTransitionCamera: "2D / 3D view", - labelTransitionDuration: "Duration", - labelTransitionStagger: "Stagger", - labelVegaSpecData: "Data reference", - labelVegaSpecNotes: "Note: You may need to change the color scheme to make this visible in Vega.", - labelYes: "Yes", - labelNo: "No", - labelConfirmation: "Are you sure?", - labelColumnTypes: "Column types", - loading: "Loading...", - schemeCategorical: "Categorical", - schemeCyclical: "Cyclical", - schemeDiverging: "Diverging", - schemeDual: "Dual", - schemeSequentialMultiHue: "Sequential Multi Hue", - schemeSequentialMultiHueDark: "For dark backgrounds", - schemeSequentialMultiHueLight: "For light backgrounds", - schemeSequentialSingleHue: "Sequential Single Hue", - selectDataSpanAll: "All rows", - selectDataSpanFilter: "Filtered", - selectDataSpanSelection: "Selected", - selectVegaSpecDataNone: "None", - selectVegaSpecDataInline: "Inline - WARNING this may use substantial browser/clipboard memory for large data sets.", - selectVegaSpecDataUrl: "URL", - record: (current, total) => `${current} of ${total}`, - searchEQ: "=", - searchNEQ: "<>", - searchGT: ">", - searchGTE: ">=", - searchLT: "<", - searchLTE: "<=", - searchNULL: "is null or empty", - searchIN: "contains", - searchSW: "starts with", - searchWHERE: "Where", - searchAND: "and", - searchOR: "or", - selectAny: "-- any --", - selectNone: "-- none --", - selectNumeric: "Numeric", - selectNonNumeric: "Categorical", - selectDirectColor: "Direct color", - selectReference: "Column mappings", - tooltipSearch: (column, value2) => `Click to search in '${column}' for "${value2}"`, - labelRequired: "required", - labelSystem: "System", - labelViewType2d: "View in 2D", - labelViewType3d: "View in 3D", - labelDataColors: "Enabled if this data column contains any CSS color values.", - labelDataNullAll: "Loading data...", - labelDataNullFiltered: "You can filter by first making a selection, then choosing Isolate or Exclude in the top bar.", - labelDataNullSelection: "You can select by:
  • clicking the chart axes
  • clicking in the legend
  • searching", - labelZeroAll: "Dataset contains zero rows.", - labelZeroSearchResults: "No rows matched your search.", - signalGroups: [ - { prefix: "Chart", label: "Chart options" }, - { prefix: "Mark", label: "Mark options" }, - { prefix: "RoleColor", label: "Color options" }, - { prefix: "RoleFacet", label: "Facet options" }, - { prefix: "RoleSort", label: "Sort options" }, - { prefix: "RoleX", label: "X axis options" }, - { prefix: "RoleY", label: "Y axis options" }, - { prefix: "RoleZ", label: "Z axis options" }, - { prefix: "Text", label: "Text options" }, - { prefix: "*", label: "Options" } - ], - percentValueFormat: (value2) => `${value2}%` - }; - function IconButton$1(props) { - return base$1.react.createElement(base$1.fluentUI.IconButton, Object.assign({}, props, { styles: props.styles || { - root: { - color: props.themePalette.black - }, - rootHovered: { - background: "transparent", - color: props.themePalette.themePrimary - }, - rootPressed: { - background: "transparent" - }, - menuIcon: { - display: "none" - } - }, iconProps: { iconName: props.iconName }, menuProps: props.menuProps })); - } - const maxCategoricalColors = 20; - function defaultColorScheme$1(c2) { - if (c2.quantitative) { - return "redyellowgreen"; - } else if (c2.stats.distinctValueCount === 2) { - return "dual_redgreen"; - } else if (c2.stats.distinctValueCount <= 10) { - return "category10"; - } - return "category20"; - } - const maxDistinctVal = 20; - const minDistinctVal = 2; - class BarChartRecommenderSummary { - constructor(columns, data2) { - let score2 = -1; - for (let i = 0; i < columns.length; i++) { - const recommendation = new BarChartRecommender(columns[i], data2).recommend(); - if (recommendation.score > score2) { - this.best = recommendation; - score2 = recommendation.score; - } - if (score2 === 1) - break; - } - for (let k = 0; k < columns.length; k++) { - const column = columns[k]; - if (column.name === this.best.columns.x || column.stats.isSequential) - continue; - if (column.quantitative || column.stats.distinctValueCount < maxCategoricalColors && column.stats.distinctValueCount > 1) { - this.best.columns.color = this.best.columns.sort = column.name; - this.best.scheme = defaultColorScheme$1(column); - if (column.quantitative) { - this.best.colorBin = "quantile"; - } - break; - } - } - } - recommend() { - return this.best; - } - } - class BarChartRecommender { - constructor(column, data2) { - this.score = 0; - this.column = column; - this.rules = [ - (column2) => { - if (column2.stats.isSequential) - return false; - else if (column2.quantitative) { - return true; - } else if (!column2.quantitative && column2.stats.distinctValueCount <= maxDistinctVal && column2.stats.distinctValueCount >= minDistinctVal) { - return true; - } else { - return false; - } - } - ]; - for (let i = 0; i < this.rules.length; i++) { - if (this.rules[i](column)) - this.score++; - } - } - recommend() { - const rec = { - chart: "barchart", - columns: { - x: this.column.name - }, - score: this.score, - scheme: void 0, - view: "2d" - }; - return rec; - } - } - const longitudeNames = ["lon", "long", "longitude"]; - const latitudeNames = ["lat", "latitude"]; - function isSpec(names, limits, column, data2) { - let is = false; - const cname = column.name.toLowerCase(); - for (let i = 0; i < names.length; i++) { - if (names[i] === cname) { - is = true; - break; - } - } - return is; - } - function isLongitude(column, data2) { - return isSpec(longitudeNames, [-180, 180], column); - } - function isLatitude(column, data2) { - return isSpec(latitudeNames, [-90, 90], column); - } - function isGeo(column, data2) { - return isLatitude(column) || isLongitude(column); - } - class ScatterPlotRecommenderSummary { - constructor(columns, data2) { - const rec = { - chart: "scatterplot", - score: void 0, - columns: {}, - scheme: void 0, - view: "2d" - }; - columns.forEach((column) => { - if (!rec.columns.x) { - if (column.name.toLowerCase() === "x") { - return rec.columns.x = column.name; - } else if (isLongitude(column)) { - return rec.columns.x = column.name; - } - } - if (!rec.columns.y) { - if (column.name.toLowerCase() === "y") { - return rec.columns.y = column.name; - } else if (isLatitude(column)) { - return rec.columns.y = column.name; - } - } - if (!rec.columns.color && !column.stats.isSequential) { - if (column.quantitative || column.stats.distinctValueCount < maxCategoricalColors) { - rec.columns.color = rec.columns.sort = column.name; - rec.scheme = defaultColorScheme$1(column); - if (column.quantitative) { - rec.colorBin = "quantile"; - } - return; - } - } - }); - if (rec.columns.x && rec.columns.y) { - this.best = rec; - } - } - recommend() { - return this.best; - } - } - function preferredColumnForTreemapSize(columns, strict) { - for (let i = 0; i < columns.length; i++) { - const c2 = columns[i]; - if (c2.quantitative) { - if (strict && c2.stats.hasNegative) - continue; - if (strict && c2.stats.isSequential) - continue; - if (strict && isGeo(c2)) - continue; - return c2; - } - } - } - class RecommenderSummary { - constructor(columns, data2) { - const quickRec = new ScatterPlotRecommenderSummary(columns, data2).recommend(); - if (quickRec) { - this.rec = quickRec; - } else { - const barChartrec = new BarChartRecommenderSummary(columns, data2).recommend(); - if (barChartrec && barChartrec.score >= 1) { - this.rec = barChartrec; - } else { - this.rec = { - chart: "grid", - columns: {}, - score: 1 - }; - } - } - } - recommend() { - return this.rec; - } - } - function ensureColumnsExist(insightColumns, actualColumns, transform2) { - for (const role in insightColumns) { - const columnName = insightColumns[role]; - const column = actualColumns.filter((c2) => c2.name === columnName)[0]; - const transformColumn = transform2 ? transform2.filter((t) => { - switch (t.type) { - case "formula": { - return t.as === columnName; - } - } - })[0] : null; - if (!(column || transformColumn)) { - delete insightColumns[role]; - } - } - } - function ensureColumnsPopulated(chart, totalStyle, insightColumns, actualColumns) { - const nonInternal = actualColumns.filter((c2) => !isInternalFieldName(c2.name)); - const firstColumn = nonInternal[0]; - const firstColumnName = firstColumn && firstColumn.name; - const firstQuantitative = nonInternal.filter((c2) => c2.quantitative)[0]; - const firstQuantitativeColumnName = firstQuantitative && firstQuantitative.name; - const ensureColumn = (role, quantitative, treemap2) => { - if (!insightColumns[role]) { - if (treemap2) { - insightColumns[role] = getTreemapColumn(actualColumns).name; - } else { - insightColumns[role] = quantitative ? firstQuantitativeColumnName : firstColumnName; - } - } - }; - function checkRequiresSize() { - switch (totalStyle) { - case "sum-strip": - case "sum-strip-percent": - ensureColumn("size", true); - break; - case "sum-treemap": - ensureColumn("size", true, true); - break; - } - } - switch (chart) { - case "barchart": - case "barchartV": - ensureColumn("x"); - checkRequiresSize(); - break; - case "barchartH": - ensureColumn("y"); - checkRequiresSize(); - break; - case "density": - ensureColumn("x"); - ensureColumn("y"); - checkRequiresSize(); - break; - case "scatterplot": - case "stacks": - ensureColumn("x"); - ensureColumn("y"); - break; - case "treemap": - if (!insightColumns.size) { - insightColumns.size = getTreemapColumn(actualColumns).name; - } - if (!insightColumns.size) { - return [strings$1.errorColumnMustBeNumeric]; - } - break; - } - } - function getTreemapColumn(columns) { - let column = preferredColumnForTreemapSize(columns, true); - if (!column) { - column = preferredColumnForTreemapSize(columns, false); - } - return column; - } - function colorMapping(insight, columns) { - if (columns && insight.columns && insight.columns.color) { - return columns.filter((c2) => c2.name === insight.columns.color)[0]; - } - } - function getBackgroundImageColumnBounds(columns) { - const bounds2 = []; - const getBound = (dimension, dataExtent2, column) => { - const { stats } = column; - const numericValue = dataExtent2 === "max" ? stats.max : stats.min; - return { - columnName: column.name, - dimension, - valid: true, - dataExtent: dataExtent2, - numericValue, - stringValue: numericValue.toString() - }; - }; - const dataExtents = ["max", "min"]; - const dimensions = ["x", "y"]; - columns.forEach((c2) => { - if (c2.quantitative) { - dimensions.forEach((dimension) => dataExtents.forEach((dataExtent2) => bounds2.push(getBound(dimension, dataExtent2, c2)))); - } - }); - return bounds2; - } - function _BackgroundImageEditor(_props) { - class __BackgroundImageEditor extends base$1.react.Component { - constructor(props) { - super(props); - this.state = { - backgroundImageColumnBounds: [], - readyToApply: false, - hidden: true - }; - } - show(insightColumns) { - const { explorer: explorer2, quantitativeColumns } = this.props; - if (!quantitativeColumns.length) { - return; - } - const xCol = quantitativeColumns.filter((c2) => c2.name === insightColumns.x)[0]; - const yCol = quantitativeColumns.filter((c2) => c2.name === insightColumns.y)[0]; - let backgroundImageColumnBounds; - if (explorer2.imageHolder.backgroundImageColumnBounds.length < quantitativeColumns.length * 4) { - backgroundImageColumnBounds = getBackgroundImageColumnBounds(explorer2.state.dataContent.columns); - } else { - backgroundImageColumnBounds = clone(explorer2.imageHolder.backgroundImageColumnBounds); - } - const newState = { hidden: false, xCol, yCol, backgroundImageColumnBounds }; - this.setState(newState); - this.checkReady(); - } - render() { - const { props, state } = this; - const { explorer: explorer2 } = props; - return base$1.react.createElement( - Dialog$1, - { hidden: state.hidden, onDismiss: () => this.setState({ hidden: true, backgroundImageFileFormatError: null }), modalProps: { - containerClassName: "sanddance-background-image-dialog" - }, dialogContentProps: { - type: base$1.fluentUI.DialogType.normal, - title: strings$1.labelBackgroundImageDialogTitle, - subText: strings$1.labelBackgroundImageSubtext - }, buttons: [ - base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: "apply", iconProps: { iconName: "Photo2Add" }, text: strings$1.buttonApply, onClick: () => this.applyImage(true), disabled: !state.readyToApply }) - ] }, - explorer2.imageHolder.img ? base$1.react.createElement( - "div", - { className: "thumbnail" }, - base$1.react.createElement("img", { src: explorer2.imageHolder.img.src }), - base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "remove", iconProps: { iconName: "Photo2Remove" }, text: strings$1.buttonRemove, onClick: () => { - explorer2.imageHolder.img = null; - this.applyImage(false); - this.setState({ readyToApply: false }); - } }) - ) : base$1.react.createElement( - "div", - { className: "thumbnail" }, - base$1.react.createElement("input", { type: "file", onChange: (e) => this.readBackgroundImage(e) }), - state.backgroundImageFileFormatError && base$1.react.createElement("div", { className: "error" }, state.backgroundImageFileFormatError) - ), - this.inputForColumn(state.xCol, "X axis", "x", strings$1.labelBackgroundLeft, strings$1.labelBackgroundRight), - this.inputForColumn(state.yCol, "Y axis", "y", strings$1.labelBackgroundBottom, strings$1.labelBackgroundTop) - ); - } - inputForColumn(column, label2, dimension, minLabel, maxLabel) { - const { props, state } = this; - const fieldInput = (label3, dataExtent2, getDefault) => { - const bounds2 = state.backgroundImageColumnBounds.filter((b2) => b2.columnName === (column === null || column === void 0 ? void 0 : column.name) && b2.dimension === dimension && b2.dataExtent === dataExtent2)[0]; - if (!bounds2) { - return null; - } - return base$1.react.createElement( - "div", - { className: "axis-bound-field" }, - base$1.react.createElement(base$1.fluentUI.TextField, { label: label3, onChange: (e, value2) => { - const numericValue = +value2; - bounds2.stringValue = value2; - bounds2.valid = !(!value2 || isNaN(numericValue)); - if (bounds2.valid) { - bounds2.numericValue = numericValue; - } - this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); - this.checkReady(); - }, value: bounds2.stringValue, errorMessage: bounds2.valid ? null : strings$1.errorNumericValue, onRenderSuffix: (a2) => { - return base$1.react.createElement(IconButton$1, { - iconName: "ScaleVolume", - themePalette: props.themePalette, - title: "Use data extent", - onClick: () => { - bounds2.numericValue = getDefault(); - bounds2.stringValue = bounds2.numericValue.toString(); - bounds2.valid = true; - this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); - this.checkReady(); - } - }); - } }) - ); - }; - return base$1.react.createElement( - "div", - { className: "axis-bounds" }, - base$1.react.createElement(base$1.fluentUI.Dropdown, { label: label2, options: props.quantitativeColumns.map((c2) => { - const option = { - key: c2.name, - text: c2.name - }; - return option; - }), onChange: (e, o) => { - const newState = { readyToApply: false }; - const newColumn = props.quantitativeColumns.filter((c2) => c2.name === o.key)[0]; - switch (dimension) { - case "x": { - newState.xCol = newColumn; - break; - } - case "y": { - newState.yCol = newColumn; - break; - } - } - this.setState(newState); - this.checkReady(); - }, selectedKey: column === null || column === void 0 ? void 0 : column.name }), - base$1.react.createElement( - "div", - { className: "axis-bound-fields" }, - fieldInput(minLabel, "min", () => column.stats.min), - fieldInput(maxLabel, "max", () => column.stats.max) - ) - ); - } - readBackgroundImage(e) { - if (e.target.files) { - const file = e.target.files[0]; - const reader = new FileReader(); - reader.onload = () => { - const img = new Image(); - img.onerror = () => { - this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); - }; - img.onload = () => { - const { src, height: height2, width: width2 } = img; - this.props.explorer.imageHolder.img = { src, height: height2, width: width2 }; - this.checkReady(); - }; - try { - img.src = reader.result; - } catch (e3) { - this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); - } - }; - reader.readAsDataURL(file); - } - } - checkReady() { - setTimeout(() => { - const { state, props } = this; - const { explorer: explorer2 } = props; - const { backgroundImageColumnBounds } = state; - let valid = true; - const dimensions = ["x", "y"]; - const dataExtents = ["max", "min"]; - [state.xCol, state.yCol].forEach((c2) => dimensions.forEach((dimension) => dataExtents.forEach((dataExtent2) => { - const bounds2 = backgroundImageColumnBounds.filter((b2) => b2.columnName === c2.name && b2.dataExtent === dataExtent2 && b2.dimension === dimension)[0]; - if (!bounds2.valid) { - valid = false; - } - }))); - const readyToApply = explorer2.imageHolder.img && valid; - this.setState({ readyToApply }); - }, 0); - } - applyImage(showBackgroundImage) { - const { props, state } = this; - const { explorer: explorer2 } = props; - explorer2.imageHolder.showBackgroundImage = showBackgroundImage; - explorer2.imageHolder.backgroundImageColumnBounds = clone(state.backgroundImageColumnBounds); - if (showBackgroundImage) { - switch (props.chart) { - case "density": - case "scatterplot": - case "stacks": { - break; - } - default: { - explorer2.changeChartType("scatterplot"); - return; - } - } - } - explorer2.forceUpdate(); - } - } - return new __BackgroundImageEditor(_props); - } - const BackgroundImageEditor = _BackgroundImageEditor; - function setInsightBackgroundImage(insight, imageHolder, columns) { - if (!imageHolder.showBackgroundImage || !columns.x || !columns.y) { - return; - } - const { backgroundImageColumnBounds } = imageHolder; - const xBounds = backgroundImageColumnBounds.filter((b2) => b2.columnName === columns.x && b2.dimension === "x"); - const yBounds = backgroundImageColumnBounds.filter((b2) => b2.columnName === columns.y && b2.dimension === "y"); - if (!xBounds.length || !yBounds.length) { - return; - } - const allBounds = [...xBounds, ...yBounds]; - for (let i = 0; i < allBounds.length; i++) { - if (!allBounds[i].valid) { - return; - } - } - const bottom = yBounds.filter((b2) => b2.dataExtent === "min")[0]; - const left = xBounds.filter((b2) => b2.dataExtent === "min")[0]; - const right = xBounds.filter((b2) => b2.dataExtent === "max")[0]; - const top = yBounds.filter((b2) => b2.dataExtent === "max")[0]; - const all = [bottom, left, right, top]; - for (let i = 0; i < all.length; i++) { - if (!all[i]) { - return; - } - } - const { src, height: height2, width: width2 } = imageHolder.img; - insight.backgroundImage = { - url: src, - size: { height: height2, width: width2 }, - extents: { - bottom: bottom.numericValue, - left: left.numericValue, - right: right.numericValue, - top: top.numericValue - } - }; - insight.size = insight.backgroundImage.size; - } - const dropdownWidth = 200; - function Dropdown$1(props) { - const newProps = Object.assign({}, props); - let selectedKey = null; - if (newProps.options && newProps.options.length > 1) { - const selectedOptions = newProps.options.filter((option) => option.selected); - if (selectedOptions && selectedOptions.length > 0) { - selectedKey = selectedOptions[0].key; - } - } - if (newProps.collapseLabel) { - newProps.onRenderTitle = ((a2, b2) => { - return base$1.react.createElement( - "span", - null, - newProps.label, - ": ", - a2[0].text - ); - }); - } - return base$1.react.createElement(base$1.fluentUI.Dropdown, Object.assign({ dropdownWidth }, newProps, { label: newProps.collapseLabel ? null : newProps.label, selectedKey })); - } - function getInitialSignalValue(explorer2, signal) { - let initialValue; - try { - initialValue = explorer2.viewer.vegaViewGl.signal(signal.name); - } catch (error2) { - } - return initialValue; - } - function Signal(props) { - if (!props.explorer.viewer || !props.signal) { - return null; - } - if (props.signal.bind) { - const input = props.signal.bind.input; - if (input) { - const fn2 = map$2[input]; - if (fn2) { - const prefix = props.prefix ? `${props.prefix} ` : ""; - const control = fn2(prefix, props.signal.bind, props.initialValue, (value2) => { - props.onChange && props.onChange(value2); - props.explorer.signal(props.signal.name, value2, props.newViewStateTarget); - }, props.disabled, props.collapseLabel, props.componentRef); - return base$1.react.createElement("div", { className: "sanddance-signal" }, control); - } - } - } - return null; - } - const map$2 = {}; - map$2["range"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { - let debouncer; - return base$1.react.createElement(base$1.fluentUI.Slider, { componentRef: ref2, label: prefix + bind2.name, max: bind2.max, min: bind2.min, step: bind2.step, defaultValue: initialValue, onChange: (value2) => { - if (debouncer) { - clearTimeout(debouncer); - } - debouncer = setTimeout(() => onChange(value2), bind2.debounce || 0); - }, disabled }); - }; - map$2["select"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { - const options2 = bind2.options.map((o, i) => { - const option = { - key: o, - text: o - }; - return option; - }); - const label2 = prefix + bind2.name; - return base$1.react.createElement(base$1.fluentUI.Dropdown, { componentRef: ref2, onRenderTitle: collapseLabel ? ((a2, b2) => base$1.react.createElement( - "span", - null, - label2, - ": ", - a2[0].text - )) : void 0, defaultSelectedKey: initialValue, label: collapseLabel ? void 0 : label2, options: options2, onChange: (e, o) => onChange(o.text), disabled }); - }; - map$2["checkbox"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { - return base$1.react.createElement(base$1.fluentUI.Toggle, { componentRef: ref2, defaultChecked: initialValue, label: prefix + bind2.name, onChange: (e, checked) => onChange(checked), disabled }); - }; - const maxFacets = 50; - const roleLabels = { - color: strings$1.labelColumnColor, - facet: strings$1.labelColumnFacet, - facetV: strings$1.labelColumnFacetV, - group: strings$1.labelColumnGroup, - size: strings$1.labelColumnSize, - sort: strings$1.labelColumnSort, - uid: null, - x: strings$1.labelColumnX, - y: strings$1.labelColumnY, - z: strings$1.labelColumnZ - }; - const aliasLabels = { - color: strings$1.labelAliasColor, - facet: strings$1.labelAliasFacet, - facetV: strings$1.labelAliasFacetV, - group: strings$1.labelAliasGroup, - size: strings$1.labelAliasSize, - sort: strings$1.labelAliasSort, - uid: null, - x: strings$1.labelAliasX, - y: strings$1.labelAliasY, - z: strings$1.labelAliasZ - }; - function filterColumnList(context2, columns) { - switch (context2) { - case "facet": - case "facetV": - return columns.filter((column) => column.quantitative || column.stats.distinctValueCount && column.stats.distinctValueCount < maxFacets); - default: - return columns.slice(); - } - } - function optionsForSpecColumn(sectionName, columns, role, disabledColumnName, selectedColumnName) { - const filtered = filterColumnList(role, columns); - const options2 = filtered.map((column) => { - const option = { - key: `column:${column.name}`, - text: column.name, - data: column, - selected: selectedColumnName === column.name, - disabled: disabledColumnName === column.name - }; - return option; - }); - if (options2.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: base$1.fluentUI.DropdownMenuItemType.Header - }; - options2.unshift(option); - } - return options2; - } - function optionsForReference(sectionName, specRoles) { - const options2 = specRoles.map((specRole) => { - const option = { - key: `role:${specRole.role}`, - text: aliasLabels[specRole.role], - data: specRole.role - }; - return option; - }).sort((a2, b2) => a2.text.localeCompare(b2.text)); - if (options2.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: base$1.fluentUI.DropdownMenuItemType.Header - }; - options2.unshift(option); - } - return options2; - } - function selectFirst(options2) { - for (let i = 0; i < options2.length; i++) { - if (options2[i].itemType === base$1.fluentUI.DropdownMenuItemType.Header) - continue; - options2[i].selected = true; - return; - } - } - function getColumnMapOptions(props) { - if (!props.specRole) - return null; - let categoricalColumns; - let directColorColumns; - let directColorGroup; - let referenceGroup = []; - if (props.specRole.role === "color") { - categoricalColumns = props.categoricalColumns.filter((c2) => !c2.isColorData); - directColorColumns = props.categoricalColumns.filter((c2) => c2.isColorData); - directColorGroup = optionsForSpecColumn(strings$1.selectDirectColor, directColorColumns, "color", props.disabledColumnName, props.selectedColumnName); - } else { - categoricalColumns = props.categoricalColumns; - } - if (props.specRole.role === "sort") { - const others = props.specCapabilities.roles.filter((specRole) => specRole.role !== props.specRole.role); - referenceGroup = optionsForReference(strings$1.selectReference, others); - } - const quantitativeGroup = optionsForSpecColumn(strings$1.selectNumeric, props.quantitativeColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); - const categoricGroup = props.specRole.excludeCategoric ? null : optionsForSpecColumn(strings$1.selectNonNumeric, categoricalColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); - const options2 = referenceGroup.concat(quantitativeGroup).concat(categoricGroup).concat(directColorGroup).filter(Boolean); - return options2; - } - function ColumnMap(props) { - const options2 = getColumnMapOptions(props); - if (props.specRole.allowNone) { - options2.unshift({ - key: -1, - text: strings$1.selectNone - }); - } - const hasSelection = options2.reduce((p, c2) => { - return p || c2.selected; - }, false); - if (!hasSelection) { - selectFirst(options2); - } - let signals; - if (props.explorer.viewer && props.explorer.viewer.vegaSpec) { - if (props.specRole.signals) { - signals = props.explorer.viewer.vegaSpec.signals.filter((s2) => props.specRole.signals.indexOf(s2.name) >= 0); - } - } - const label2 = roleLabels[props.specRole.role]; - const signalElements = !props.hideSignals && signals && signals.map((signal, i) => { - let initialValue; - try { - initialValue = props.explorer.viewer.vegaViewGl.signal(signal.name); - } catch (error2) { - } - return base$1.react.createElement(Signal, { key: signal.name + i + initialValue, explorer: props.explorer, signal, initialValue, onChange: (value2) => props.onChangeSignal && props.onChangeSignal(signal.name, value2), collapseLabel: props.collapseLabel }); - }); - return base$1.react.createElement( - "div", - { className: "sanddance-columnMap" }, - props.prefix, - !props.hideDropdown && base$1.react.createElement(Dropdown$1, { componentRef: props.componentRef, collapseLabel: props.collapseLabel, disabled: props.disabled, label: label2, options: options2, onChange: (e, o) => props.changeColumnMapping(props.specRole.role, typeof o.data === "string" ? o.data : clone(o.data)), onDismiss: props.onDismiss }), - signalElements, - props.suffix - ); - } - function attachSpecRoleToAxisTitle(stage, specCapabilities) { - for (const axisName in stage.axes) { - specCapabilities.roles.forEach((specRole) => { - if (specRole.role === axisName) { - const axes = stage.axes[axisName]; - axes.forEach((axis) => { - if (axis.title) { - const textItem = axis.title; - textItem.specRole = specRole; - } - }); - } - }); - } - } - function px$1(n) { - return n + "px"; - } - function _PositionedColumnMap(_props) { - class __PositionedColumnMap extends base$1.react.Component { - constructor(props) { - super(props); - const { left, top } = props; - this.state = { left, top }; - this.dropdownRef = base$1.react.createRef(); - } - focus() { - if (!this.focused) { - this.focused = true; - this.dropdownRef.current.focus(true); - } - } - componentDidMount() { - const size = outerSize$1(this.div); - const over = { - left: Math.max(0, this.state.left + size.width - this.props.container.offsetWidth), - top: Math.max(0, this.state.top + size.height - this.props.container.offsetHeight) - }; - if (over.left || over.top) { - let { left, top } = this.state; - left -= over.left; - top -= over.top; - this.setState({ left, top }); - } else { - this.focus(); - } - } - componentDidUpdate() { - this.focus(); - } - render() { - return base$1.react.createElement( - "div", - { ref: (div) => { - if (div) - this.div = div; - }, className: "sanddance-columnMap-absolute", style: { position: "absolute", left: px$1(this.state.left), top: px$1(this.state.top) } }, - base$1.react.createElement(ColumnMap, Object.assign({}, this.props, { componentRef: this.dropdownRef, hideSignals: true })) - ); - } - } - return new __PositionedColumnMap(_props); - } - const PositionedColumnMap = _PositionedColumnMap; - function _ColumnTypeChanger(_props) { - class __ColumnTypeChanger extends base$1.react.Component { - constructor(props) { - super(props); - this.state = this.getInitialState(); - } - getInitialState() { - const { props } = this; - return { - dialogHidden: true, - confirmationHidden: true, - quantitativeColumns: props.initialQuantitativeColumns.map((c2) => clone(c2)), - categoricalColumns: props.initialCategoricalColumns.map((c2) => clone(c2)), - columnTypes: null - }; - } - closeDialog() { - this.setState(this.getInitialState()); - } - openConfirmation(columnTypes) { - this.setState({ columnTypes, confirmationHidden: false }); - } - render() { - const { props, state } = this; - const hasChanges = props.initialQuantitativeColumns.some((c2, i) => { - return c2.quantitative !== state.quantitativeColumns[i].quantitative; - }); - return base$1.react.createElement( - "div", - null, - base$1.react.createElement(base$1.fluentUI.DefaultButton, { text: strings$1.buttonColumnTypes, onClick: () => this.setState({ dialogHidden: false }) }), - base$1.react.createElement( - Dialog$1, - { minWidth: "80%", hidden: state.dialogHidden, onDismiss: () => this.closeDialog(), dialogContentProps: { - className: `sanddance-dialog ${props.theme}`, - type: base$1.fluentUI.DialogType.normal, - title: strings$1.labelColumnTypes - }, buttons: [ - base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "revert", text: strings$1.buttonResetToDefault, onClick: () => this.openConfirmation(null), iconProps: { iconName: "Undo" } }), - base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "apply", text: strings$1.buttonApply, onClick: () => { - const columnTypes = {}; - state.quantitativeColumns.forEach((c2) => { - columnTypes[c2.name] = c2.quantitative ? c2.type : "string"; - }); - state.categoricalColumns.forEach((c2) => { - columnTypes[c2.name] = "string"; - }); - this.openConfirmation(columnTypes); - }, iconProps: { iconName: "Accept" }, disabled: !hasChanges }) - ] }, - base$1.react.createElement( - "div", - { className: "sanddance-columnTypes" }, - state.quantitativeColumns.length > 0 && base$1.react.createElement( - "div", - null, - base$1.react.createElement("h3", null, strings$1.selectNumeric), - base$1.react.createElement( - "table", - null, - base$1.react.createElement( - "thead", - null, - base$1.react.createElement( - "tr", - null, - base$1.react.createElement("th", null, strings$1.labelEditColumn), - base$1.react.createElement("th", null, strings$1.labelColumnName), - base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMin), - base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMax), - base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMean), - base$1.react.createElement("th", null, strings$1.labelColumnDistinct) - ) - ), - base$1.react.createElement("tbody", null, state.quantitativeColumns.map((c2, i) => base$1.react.createElement( - "tr", - { key: i, className: c2.quantitative ? "" : "changed" }, - base$1.react.createElement( - "td", - null, - base$1.react.createElement(IconButton$1, { iconName: "Edit", onClick: void 0, menuProps: { - items: [strings$1.selectNumeric, strings$1.selectNonNumeric].map((t) => { - return { - key: t, - text: t, - onClick: () => { - c2.quantitative = t === strings$1.selectNumeric; - this.setState({ quantitativeColumns: [...state.quantitativeColumns] }); - } - }; - }) - }, themePalette: props.themePalette, title: strings$1.labelChangeColumnType }) - ), - base$1.react.createElement("td", null, c2.name), - base$1.react.createElement("td", null, c2.stats.min), - base$1.react.createElement("td", null, c2.stats.max), - base$1.react.createElement("td", null, c2.stats.mean), - base$1.react.createElement("td", null, c2.stats.distinctValueCount) - ))) - ) - ), - state.categoricalColumns.length > 0 && base$1.react.createElement( - "div", - null, - base$1.react.createElement("h3", null, strings$1.selectNonNumeric), - base$1.react.createElement( - "table", - null, - base$1.react.createElement( - "thead", - null, - base$1.react.createElement( - "tr", - null, - base$1.react.createElement("th", null, strings$1.labelColumnName), - base$1.react.createElement("th", null, strings$1.labelColumnType), - base$1.react.createElement("th", null, strings$1.labelColumnDistinct), - base$1.react.createElement("th", null, strings$1.labelColumnHasColorData), - base$1.react.createElement("th", null, strings$1.labelColumnIsColorData) - ) - ), - base$1.react.createElement("tbody", null, state.categoricalColumns.map((c2, i) => base$1.react.createElement( - "tr", - { key: i }, - base$1.react.createElement("td", null, c2.name), - base$1.react.createElement("td", null, c2.type), - base$1.react.createElement("td", null, c2.stats.distinctValueCount), - base$1.react.createElement("td", null, (!!c2.stats.hasColorData).toString()), - base$1.react.createElement("td", null, (!!c2.isColorData).toString()) - ))) - ) - ) - ) - ), - base$1.react.createElement(Dialog$1, { hidden: state.confirmationHidden, onDismiss: () => this.setState({ confirmationHidden: true }), dialogContentProps: { - className: `sanddance-dialog ${props.theme}`, - type: base$1.fluentUI.DialogType.normal, - title: strings$1.labelConfirmation, - subText: strings$1.labelHistoryWarning - }, buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { text: strings$1.buttonApply, onClick: () => { - this.closeDialog(); - this.props.onConfirmUpdate(this.state.columnTypes); - }, iconProps: { iconName: "Accept" } }) }) - ); - } - } - return new __ColumnTypeChanger(_props); - } - const ColumnTypeChanger = _ColumnTypeChanger; - const embedHtml = (title, embed) => ` + this._core = core; + this._obj = options.obj; + this._texture = options.texture || new ImageData(new Uint8ClampedArray([ + 0, + 0, + 0, + 255 + ]), 1, 1); + } + initialize() { + const _vec3 = create$6(); + this._mMatrix = create$7(); + const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); + if (!this._obj) { + this.useRayPose = true; + const modelThickness = .02; + set$8(_vec3, modelThickness, modelThickness, .1); + fromScaling(this._mMatrix, _vec3); + set$8(_vec3, 0, 0, 1); + translate$2(this._mMatrix, this._mMatrix, _vec3); + } + this._vertices = objMesh.vertices; + this._indices = objMesh.indices; + this._indexCount = objMesh.indexCount; + this._rayMMatrix = create$7(); + const rayVertices = Cube.POSITIONS; + this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); + const rayVerticesView = new DataView(this._rayVertices); + const rayIndices = Cube.INDICES; + this._rayIndices = new Uint16Array(rayIndices); + const rayVertexCount = rayVertices.length / PositionVertex.SIZE; + this._rayIndexCount = rayIndices.length; + for (let i = 0; i < rayVertexCount; i++) { + set$8(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); + PositionColorVertex.setPosition(rayVerticesView, i, _vec3); + PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); + } + const rayThickness = .0025; + set$8(_vec3, rayThickness, rayThickness, 10); + fromScaling(this._rayMMatrix, _vec3); + set$8(_vec3, 0, 0, -.5); + translate$2(this._rayMMatrix, this._rayMMatrix, _vec3); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "controller initialized"); + } + update(elapsedTime) {} + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/matrix.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var MatrixHelper = class { + static fieldOfViewFromProjectionMatrix(p) { + return 2 * Math.atan(1 / p[5]); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/components/axes/axes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AxesVisual = class { + render(elapsedTime, xrFrame) {} + update(elapsedTime) {} + constructor(axes) { + this.axes = axes; + } + }; + var AxesBase = class { + get isInitialized() { + return this._isInitialized; + } + set vMatrix(value) { + this._vMatrix = value; + } + pickGrid(id) { + const offset = id * 3; + return { + divisionX: this._pickGrid[offset] - 1, + divisionY: this._pickGrid[offset + 1] - 1, + divisionZ: this._pickGrid[offset + 2] - 1 + }; + } + pickTitle(id) { + return { axis: this._pickTitle[id] }; + } + pickLabel(id) { + const offset = id * 2; + return { + axis: this._pickLabel[offset], + label: this._pickLabel[offset + 1] + }; + } + pickHeading(id) { + return { axis: this._pickHeading[id] }; + } + getFromValues(index) { + return this._fromValues[index]; + } + setFromValues(index, value) { + if (this._fromValues[index] != value) { + this._fromValues[index] = value; + this._hasChanged = true; + } + } + getToValues(index) { + return this._toValues[index]; + } + setToValues(index, value) { + if (this._toValues[index] != value) { + this._toValues[index] = value; + this._hasChanged = true; + } + } + get font() { + return this._font; + } + set font(value) { + if (this._font != value) { + this._font = value; + this._hasChanged = true; + } + } + get gridPickDivisionHeight() { + return this._gridPickDivisionHeight; + } + set gridPickDivisionHeight(value) { + if (this._gridPickDivisionHeight != value) { + this._gridPickDivisionHeight = value; + this._hasChanged = true; + } + } + constructor(core) { + this._core = core; + this._mMatrix = create$7(); + this._mvMatrix = create$7(); + this._textMetric = { + maxTop: 0, + width: 0, + maxHeight: 0 + }; + this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; + this.textBorderWidth = core.config.textBorderWidth; + this.gamma = 0; + this.gridMajorThickness = core.config.axesGridMajorThickness; + this.gridMinorThickness = core.config.axesGridMinorThickness; + this.gridZeroThickness = core.config.axesGridZeroThickness; + this._font = core.font; + this.isGridPickingEnabled = false; + } + update(elapsedTime) {} + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/meshes/quad.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Quad$2 = class { + static positions(transform) { + const positions = new Float32Array(12); + const position = create$6(); + for (let i = 0; i < 4; i++) { + set$8(position, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); + transformMat4$2(position, position, transform); + positions[i * 3] = position[0]; + positions[i * 3 + 1] = position[1]; + positions[i * 3 + 2] = position[2]; + } + return positions; + } + static textured(transform, texTransform = Constants$2.MAT4_IDENTITY) { + const positions = this.positions(transform); + const texCoords = this.TEX_COORDS; + const vertices = /* @__PURE__ */ new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position = create$6(); + const texCoord = create$3(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$8(position, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionTextureVertex.setPosition(verticesView, i, position); + PositionTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + static normalTextured(transform, texTransform = Constants$2.MAT4_IDENTITY) { + const positions = this.positions(transform); + const texCoords = this.TEX_COORDS; + const vertices = /* @__PURE__ */ new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position = create$6(); + const texCoord = create$3(); + const normal3 = create$6(); + const normal4 = create$5(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$8(position, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionNormalTextureVertex.setPosition(verticesView, i, position); + set$7(normal4, 0, 0, 1, 0); + transformMat4$1(normal4, normal4, transform); + set$8(normal3, normal4[0], normal4[1], normal4[2]); + normalize$5(normal3, normal3); + PositionNormalTextureVertex.setNormal(verticesView, i, normal3); + PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + }; + Quad$2.FACE_NORMALS = [fromValues$3(0, 0, 1), fromValues$3(0, 0, -1)]; + Quad$2.FACE_ROTATIONS = [fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1)]; + Quad$2.EDGE_POSITIONS = [ + fromValues$3(0, .5, 0), + fromValues$3(.5, 0, 0), + fromValues$3(0, -.5, 0), + fromValues$3(-.5, 0, 0) + ]; + Quad$2.EDGE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0) + ]; + Quad$2.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0) + ]; + Quad$2.EDGE_FORWARDS = [ + fromValues$3(0, 0, -1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$2.AXIS_EDGES = [[0, 2], [1, 3]]; + Quad$2.POSITIONS = new Float32Array([ + -.5, + .5, + 0, + .5, + .5, + 0, + -.5, + -.5, + 0, + .5, + -.5, + 0 + ]); + Quad$2.INDICES = new Uint16Array([ + 0, + 2, + 1, + 1, + 2, + 3 + ]); + Quad$2.TEX_COORDS = new Float32Array([ + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0 + ]); + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/text.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var TextHelper = class { + static truncate(text, length) { + return text.length > length ? `${text.substr(0, length - 1)}…` : text; + } + static measure(font, text, size) { + size.width = 0; + let maxDescent = 0; + for (const char of text) { + let glyph = font.glyphs[char]; + if (!glyph) { + font.addGlyph(char); + glyph = font.glyphs[char]; + } + size.width += glyph.advance; + size.maxTop = Math.max(glyph.top, size.maxTop); + maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + } + size.maxHeight = size.maxTop + maxDescent; + } + static wrap(font, text, maxWidth) { + const lines = []; + let width = 0; + let start = 0; + let lastBreakingChar = -1; + let widthAfterLastBreakingChar = 0; + for (let i = 0; i < text.length; i++) { + let char = text.charAt(i); + let glyph = font.glyphs[char]; + if (!glyph) { + font.addGlyph(char); + glyph = font.glyphs[char]; + } + width += glyph.advance; + if (char == " " || char == "-") { + widthAfterLastBreakingChar = width; + lastBreakingChar = i; + } + if (width > maxWidth) if (lastBreakingChar == -1) { + lines.push(text.substring(start, i)); + start = i; + width += glyph.advance; + } else { + lines.push(text.substring(start, lastBreakingChar)); + start = lastBreakingChar + 1; + width -= widthAfterLastBreakingChar; + widthAfterLastBreakingChar = 0; + lastBreakingChar = -1; + } + } + lines.push(text.substring(start, text.length)); + return lines; + } + static addString(font, text, vertices, indices, index, position, scale, offset, rotation, idColor) { + for (const char of text) this.addGlyph(font, char, vertices, indices, index++, position, scale, offset, rotation, idColor); + } + static addGlyph(font, char, vertices, indices, index, position, scale, offset, rotation, idColor) { + let glyph = font.glyphs[char]; + if (!glyph) { + font.addGlyph(char); + glyph = font.glyphs[char]; + } + const vertexOffset = index * 4; + const width = glyph.width * scale; + const height = glyph.height * scale; + const top = glyph.top * scale; + const border = font.border * scale; + const x0 = offset[0] - border; + const x1 = offset[0] + width + border; + const y0 = offset[1] + top + border; + const y1 = offset[1] + top - height - border; + const z0 = offset[2]; + set$8(this._topLeft, x0, y0, z0); + set$8(this._topRight, x1, y0, z0); + set$8(this._bottomLeft, x0, y1, z0); + set$8(this._bottomRight, x1, y1, z0); + if (rotation) { + transformQuat(this._topLeft, this._topLeft, rotation); + transformQuat(this._topRight, this._topRight, rotation); + transformQuat(this._bottomLeft, this._bottomLeft, rotation); + transformQuat(this._bottomRight, this._bottomRight, rotation); + } + add$4(this._vec3, this._topLeft, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); + add$4(this._vec3, this._topRight, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); + add$4(this._vec3, this._bottomLeft, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); + add$4(this._vec3, this._bottomRight, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); + set$5(this._vec2, glyph.u0, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); + set$5(this._vec2, glyph.u1, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); + set$5(this._vec2, glyph.u0, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); + set$5(this._vec2, glyph.u1, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); + offset[0] += glyph.advance * scale; + const indexTemplate = Quad$2.INDICES; + const indexOffset = index * 6; + for (let i = 0; i < 6; i++) indices[indexOffset + i] = indexTemplate[i] + vertexOffset; + } + }; + TextHelper._vec2 = create$3(); + TextHelper._vec3 = create$6(); + TextHelper._topLeft = create$6(); + TextHelper._topRight = create$6(); + TextHelper._bottomLeft = create$6(); + TextHelper._bottomRight = create$6(); + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/pick.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var PickHelper = class PickHelper { + static nextPickId() { + return this._pickId++; + } + static encodeNumber(number, type, color) { + const encoded = number | PickHelper.encodeType(type); + PickHelper.float32ToVec4(encoded, color); + } + static decodeNumber(color) { + return color[0] + (color[1] << 8) + (color[2] << 16); + } + static encodeVec3(vec3, type, color) { + const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type); + PickHelper.float32ToVec4(encoded, color); + } + static decodeVec3(color, axes) { + axes[0] = color[0]; + axes[1] = color[1]; + axes[2] = color[2]; + } + static encodeType(type) { + return type << 24; + } + static decodeType(color) { + return color[3]; + } + static float32ToVec4(number, color) { + color[0] = ((number & 255) >>> 0) / 255; + color[1] = ((number & 65280) >>> 8) / 255; + color[2] = ((number & 16711680) >>> 16) / 255; + color[3] = ((number & 4278190080) >>> 24) / 255; + } + static uint8ArrayToNumber(color) { + return color[0] + (color[1] << 8) + (color[2] << 16) + (color[3] << 24); + } + }; + PickHelper._pickId = 1; + //#endregion + //#region ../../node_modules/morphcharts/dist/components/axes/cartesian3d.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cartesian3dAxes = class extends AxesBase { + get size() { + return this._size; + } + get isDiscreteX() { + return this._isDiscrete[0]; + } + set isDiscreteX(value) { + if (value != this._isDiscrete[0]) { + this._isDiscrete[0] = value; + this._hasChanged = true; + } + } + get isDiscreteY() { + return this._isDiscrete[1]; + } + set isDiscreteY(value) { + if (value != this._isDiscrete[1]) { + this._isDiscrete[1] = value; + this._hasChanged = true; + } + } + get isDiscreteZ() { + return this._isDiscrete[2]; + } + set isDiscreteZ(value) { + if (value != this._isDiscrete[2]) { + this._isDiscrete[2] = value; + this._hasChanged = true; + } + } + get minBoundsX() { + return this._minBoundsX; + } + set minBoundsX(value) { + if (value != this._minBoundsX) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsX() { + return this._maxBoundsX; + } + set maxBoundsX(value) { + if (value != this._minBoundsX) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { + return this._minBoundsY; + } + set minBoundsY(value) { + if (value != this._minBoundsY) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsY() { + return this._maxBoundsY; + } + set maxBoundsY(value) { + if (value != this._minBoundsY) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + get minBoundsZ() { + return this._minBoundsZ; + } + set minBoundsZ(value) { + if (value != this._minBoundsZ) { + this._minBoundsZ = value; + this._hasChanged = true; + } + } + get maxBoundsZ() { + return this._maxBoundsZ; + } + set maxBoundsZ(value) { + if (value != this._minBoundsZ) { + this._maxBoundsZ = value; + this._hasChanged = true; + } + } + getIsOutsideEdge(index) { + return this._isOutsideEdge[index]; + } + getIsForwardFace(index) { + return this._isForwardFace[index]; + } + get textVertices() { + return this._textVertices; + } + get textIndices() { + return this._textIndices; + } + getLabelMMatrix(index) { + return this._labelMMatrices[index]; + } + setLabelPositions(index, value) { + if (this._labelPositions[index] != value) { + this._labelPositions[index] = value; + this._hasChanged = true; + } + } + setLabels(index, value) { + if (this._labels[index] != value) { + this._labels[index] = value; + this._hasChanged = true; + } + } + setLabelSizes(index, value) { + if (this._labelSizes[index] != value) { + this._labelSizes[index] = value; + this._hasChanged = true; + } + } + getLabelOrientation(index) { + return this._orientations[index]; + } + setLabelOrientation(index, orientation) { + if (this._orientations[index] != orientation) { + this._orientations[index] = orientation; + this._hasChanged = true; + } + } + getTitleIndexCount(index) { + return this._titleIndexCounts[index]; + } + getTitleIndexOffset(index) { + return this._titleIndexOffsets[index]; + } + getTitleMMatrix(index) { + return this._titleMMatrices[index]; + } + setTitle(index, value) { + if (this._titles[index] != value) { + this._titles[index] = value; + this._hasChanged = true; + } + } + setTitleSize(index, value) { + if (this._titleSizes[index] != value) { + this._titleSizes[index] = value; + this._hasChanged = true; + } + } + getHeadingIndexCount(index) { + return this._headingIndexCounts[index]; + } + getHeadingIndexOffset(index) { + return this._headingIndexOffsets[index]; + } + getHeadingMMatrix(index) { + return this._headingMMatrices[index]; + } + setHeading(index, value) { + if (this._headings[index] != value) { + this._headings[index] = value; + this._hasChanged = true; + } + } + setHeadingSize(index, value) { + if (this._headingSizes[index] != value) { + this._headingSizes[index] = value; + this._hasChanged = true; + } + } + getIsLeftToRightHorizontal(index) { + return this._isLeftToRightHorizontal[index]; + } + getIsLeftToRightVertical(index) { + return this._isLeftToRightVertical[index]; + } + getAxesLeftToRightIndexCount(index) { + return this._axesLeftToRightIndexCounts[index]; + } + getAxesRightToLeftIndexCount(index) { + return this._axesRightToLeftIndexCounts[index]; + } + getAxesLeftToRightIndexOffset(index) { + return this._axesLeftToRightIndexOffsets[index]; + } + getAxesRightToLeftIndexOffset(index) { + return this._axesRightToLeftIndexOffsets[index]; + } + get gridVertices() { + return this._gridVertices; + } + get gridIndices() { + return this._gridIndices; + } + getGridTicksIndexCount(index) { + return this._gridTicksIndexCounts[index]; + } + getGridTicksIndexOffset(index) { + return this._gridTicksIndexOffsets[index]; + } + getGridFaceIndexCount(index) { + return this._gridFaceIndexCounts[index]; + } + getGridFaceIndexOffset(index) { + return this._gridFaceIndexOffsets[index]; + } + getGridTicksMMatrix(index) { + return this._gridTicksMMatrices[index]; + } + getGridFaceMMatrix(index) { + return this._gridFaceMMatrices[index]; + } + getGridTicksScale(index) { + return this._gridTicksScales[index]; + } + getGridFaceZero(index) { + return this._gridFaceZeros[index]; + } + getGridTicksZero(index) { + return this._gridTicksZeros[index]; + } + getGridFaceMinorGridlines(index) { + return this._gridFaceMinorGridlines[index]; + } + getGridTicksMinorGridlines(index) { + return this._gridTicksMinorGridlines[index]; + } + setTickPositions(index, value) { + if (this._gridTicksPositions[index] != value) { + this._gridTicksPositions[index] = value; + this._hasChanged = true; + } + } + get scalingX() { + return this._scalingX; + } + set scalingX(value) { + if (value != this._scalingX) { + this._scalingX = value; + this._hasChanged = true; + } + } + get scalingY() { + return this._scalingY; + } + set scalingY(value) { + if (value != this._scalingY) { + this._scalingY = value; + this._hasChanged = true; + } + } + get scalingZ() { + return this._scalingZ; + } + set scalingZ(value) { + if (value != this._scalingZ) { + this._scalingZ = value; + this._hasChanged = true; + } + } + get offsetX() { + return this._offset[12]; + } + set offsetX(value) { + if (value != this._offset[12]) this._offset[12] = value; + } + get offsetY() { + return this._offset[13]; + } + set offsetY(value) { + if (value != this._offset[13]) this._offset[13] = value; + } + get offsetZ() { + return this._offset[14]; + } + set offsetZ(value) { + if (value != this._offset[14]) this._offset[14] = value; + } + constructor(core) { + super(core); + this._size = create$6(); + this._translation = create$6(); + this._normal = create$6(); + this._forward = create$6(); + this._right = create$6(); + this._up = create$6(); + this._texCoord = create$3(); + this._bounds = create$5(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mat3 = create$8(); + this._isDiscrete = [ + false, + false, + false + ]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._minBoundsZ = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._maxBoundsZ = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 6; i++) this._isForwardFace.push(false); + for (let i = 0; i < 12; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$6(); + this._textPosition = create$6(); + this._distances = []; + for (let i = 0; i < 12; i++) this._distances.push(0); + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 3; i++) { + this._maxLabelSize.push(create$3()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) this._labelMMatrices.push(create$7()); + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 3; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) this._titleMMatrices.push(create$7()); + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 3; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._headingMMatrices.push(create$7()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$6(); + this._edgePositive = create$6(); + this._edgeNormal = create$6(); + this._edgeNormalTemp = create$6(); + this._edgePositiveTemp = create$6(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 12; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$6()); + this._edgeHorizontalUp.push(create$6()); + this._edgeHorizontalForward.push(create$6()); + this._edgeVerticalRight.push(create$6()); + this._edgeVerticalUp.push(create$6()); + this._edgeVerticalForward.push(create$6()); + } + this.isFaceVisible = []; + for (let i = 0; i < 6; i++) this.isFaceVisible.push(true); + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$6(); + this._gridTicksZeros = []; + this._gridFaceZeros = []; + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = []; + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$6(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 3; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create$3()); + this._gridFaceZeros.push(create$3()); + this._gridTicksMinorGridlines.push(create$3()); + this._gridFaceMinorGridlines.push(create$3()); + this._gridTicksScales.push(create$6()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + } + for (let i = 0; i < 6; i++) { + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$7()); + } + for (let i = 0; i < 12; i++) { + this._gridTicksMMatrices.push(create$7()); + this._gridTicksRotations.push(create$7()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Cube.EDGE_POSITIVES[i][0]; + _mat4[1] = Cube.EDGE_POSITIVES[i][1]; + _mat4[2] = Cube.EDGE_POSITIVES[i][2]; + _mat4[4] = Cube.EDGE_NORMALS[i][0]; + _mat4[5] = Cube.EDGE_NORMALS[i][1]; + _mat4[6] = Cube.EDGE_NORMALS[i][2]; + cross$1(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [ + null, + null, + null + ]; + this._toValues = [ + null, + null, + null + ]; + this.isDivisionPickingEnabled = [ + false, + false, + false + ]; + this.isLabelPickingEnabled = [ + false, + false, + false + ]; + this.isTitlePickingEnabled = [ + false, + false, + false + ]; + this.isHeadingPickingEnabled = [ + false, + false, + false + ]; + this.isAxisReversed = [ + false, + false, + false + ]; + this._scalingX = 1; + this._scalingY = 1; + this._scalingZ = 1; + this._offset = create$7(); + } + initialize() { + this._isInitialized = true; + } + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); + const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._size[2] *= this._scalingZ / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) this.hasChangedCallback(); + this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); + } + multiply$2(this._mMatrix, this.mMatrix, this._offset); + this._mvMatrix = create$7(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 6; faceId++) { + multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); + transformMat4$2(this._forward, this._vec3, this._mvMatrix); + transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 12; edgeId++) { + const faceIds = Cube.EDGE_FACES[edgeId]; + const outsideEdge = this._isForwardFace[faceIds[0]] != this._isForwardFace[faceIds[1]]; + this._isOutsideEdge[edgeId] = outsideEdge; + if (outsideEdge) this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 3; axisId++) if (this.arePickDivisionsVisible[axisId]) { + set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { + let distance = this._distances[edgeId]; + distance += this._gridPickDivisionHeight * .5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$2.VECTOR3_REFLECTX); + scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance += this._gridPickDivisionHeight * .5; + this._distances[edgeId] = distance; + } + } + } + for (let axisId = 0; axisId < 3; axisId++) if (this.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + set$5(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); + set$5(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + if (this._size[axisId] > 0) translate$2(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); + } + } + } + for (let axisId = 0; axisId < 3; axisId++) for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId]) { + multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$5(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross$1(this._right, Constants$2.VECTOR3_UNITY, this._forward); + normalize$5(this._right, this._right); + cross$1(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); + copy$6(this._edgeNormalTemp, this._edgeNormal); + copy$6(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) copy$6(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + else { + negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$6(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) copy$6(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + else { + negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$6(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) this._updateLabels(axisId, edgeId); + if (this._titles[axisId]) this._updateTitle(axisId, edgeId); + } + if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); + } + } + } + } + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance += maxLabelSize * .5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) multiply$2(labelMMatrix, labelMMatrix, Constants$2.MAT4_ROTATION_MINUS_90); + distance += maxLabelSize * .5; + this._distances[edgeId] = distance; + } + _updateTitle(axisId, edgeId) { + let distance = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance += titleTextSize * .5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance += titleTextSize * .5; + this._distances[edgeId] = distance; + } + _updateHeading(axisId, edgeId) { + let distance = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance += headingTextSize * .5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance += headingTextSize * .5; + this._distances[edgeId] = distance; + } + _updateGrids(size) { + let offset = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; + const count = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count * 6); + } + for (let axisId = 0; axisId < 3; axisId++) { + const width = size[axisId]; + set$8(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); + offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); + } + this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; + } + } + _updateText(size) { + let glyphOffset = 0; + let count = 0; + for (let axisId = 0; axisId < 3; axisId++) { + const labels = this._labels[axisId]; + if (labels) for (let i = 0; i < labels.length; i++) count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + const title = this._titles[axisId]; + if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + const heading = this._headings[axisId]; + if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 3; axisId++) if (this._labels[axisId]) { + const width = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set$5(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 3; axisId++) if (this._titles[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 3; axisId++) if (this._headings[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (position - .5) * size, 0, 0); + if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; + else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + maxSize[0] = Math.max(width, maxSize[0]); + maxSize[1] = Math.max(lineHeight, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (position - .5) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; + else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; + maxSize[0] = Math.max(lineHeight, maxSize[0]); + maxSize[1] = Math.max(width, maxSize[1]); + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (.5 - position) * size, 0, 0); + if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; + else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (.5 - position) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; + else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateGridTicks(axisId, dataView, indices, offset) { + this._gridTicksIndexOffsets[axisId] = offset * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$6(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset * 4; + for (let position = 0; position < positions.length - 1; position++) { + const left = isAxisReversed ? 1 - positions[position + 1] - .5 : positions[position] - .5; + const right = isAxisReversed ? 1 - positions[position] - .5 : positions[position + 1] - .5; + axes[axisId] = position + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let j = 0; j < this._indexTemplate.length; j++) indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + set$7(this._bounds, left + .5, 0, right + .5, 1); + this._translation[0] = left; + this._translation[1] = .5; + this._translation[2] = 0; + this._texCoord[0] = left + .5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -.5; + this._texCoord[0] = left + .5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; + return offset; + } + _updateGridFace(axisId, faceId, dataView, indices, offset) { + set$8(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$6(); + negate(this._normal, Cube.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - .5 : positions2[position2] - .5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - .5 : positions2[position2 + 1] - .5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - .5 : positions3[position3] - .5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - .5 : positions3[position3 + 1] - .5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let i = 0; i < this._indexTemplate.length; i++) indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + set$7(this._bounds, min2 + .5, min3 + .5, max2 + .5, max3 + .5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + .5; + this._texCoord[1] = max3 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + .5; + this._texCoord[1] = min3 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; + return offset; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/components/axes/cartesian2d.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cartesian2dAxes = class extends AxesBase { + get size() { + return this._size; + } + get isDiscreteX() { + return this._isDiscrete[0]; + } + set isDiscreteX(value) { + if (value != this._isDiscrete[0]) { + this._isDiscrete[0] = value; + this._hasChanged = true; + } + } + get isDiscreteY() { + return this._isDiscrete[1]; + } + set isDiscreteY(value) { + if (value != this._isDiscrete[1]) { + this._isDiscrete[1] = value; + this._hasChanged = true; + } + } + get minBoundsX() { + return this._minBoundsX; + } + set minBoundsX(value) { + if (value != this._minBoundsX) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsX() { + return this._maxBoundsX; + } + set maxBoundsX(value) { + if (value != this._minBoundsX) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { + return this._minBoundsY; + } + set minBoundsY(value) { + if (value != this._minBoundsY) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsY() { + return this._maxBoundsY; + } + set maxBoundsY(value) { + if (value != this._minBoundsY) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + getIsOutsideEdge(index) { + return this._isOutsideEdge[index]; + } + getIsForwardFace(index) { + return this._isForwardFace[index]; + } + get textVertices() { + return this._textVertices; + } + get textIndices() { + return this._textIndices; + } + getLabelMMatrix(index) { + return this._labelMMatrices[index]; + } + setLabelPositions(index, value) { + if (this._labelPositions[index] != value) { + this._labelPositions[index] = value; + this._hasChanged = true; + } + } + setLabels(index, value) { + if (this._labels[index] != value) { + this._labels[index] = value; + this._hasChanged = true; + } + } + setLabelSizes(index, value) { + if (this._labelSizes[index] != value) { + this._labelSizes[index] = value; + this._hasChanged = true; + } + } + getLabelOrientation(index) { + return this._orientations[index]; + } + setLabelOrientation(index, orientation) { + if (this._orientations[index] != orientation) { + this._orientations[index] = orientation; + this._hasChanged = true; + } + } + getTitleIndexCount(index) { + return this._titleIndexCounts[index]; + } + getTitleIndexOffset(index) { + return this._titleIndexOffsets[index]; + } + getTitleMMatrix(index) { + return this._titleMMatrices[index]; + } + setTitle(index, value) { + if (this._titles[index] != value) { + this._titles[index] = value; + this._hasChanged = true; + } + } + setTitleSize(index, value) { + if (this._titleSizes[index] != value) { + this._titleSizes[index] = value; + this._hasChanged = true; + } + } + getHeadingIndexCount(index) { + return this._headingIndexCounts[index]; + } + getHeadingIndexOffset(index) { + return this._headingIndexOffsets[index]; + } + getHeadingMMatrix(index) { + return this._headingMMatrices[index]; + } + setHeading(index, value) { + if (this._headings[index] != value) { + this._headings[index] = value; + this._hasChanged = true; + } + } + setHeadingSize(index, value) { + if (this._headingSizes[index] != value) { + this._headingSizes[index] = value; + this._hasChanged = true; + } + } + getIsLeftToRightHorizontal(index) { + return this._isLeftToRightHorizontal[index]; + } + getIsLeftToRightVertical(index) { + return this._isLeftToRightVertical[index]; + } + getAxesLeftToRightIndexCount(index) { + return this._axesLeftToRightIndexCounts[index]; + } + getAxesRightToLeftIndexCount(index) { + return this._axesRightToLeftIndexCounts[index]; + } + getAxesLeftToRightIndexOffset(index) { + return this._axesLeftToRightIndexOffsets[index]; + } + getAxesRightToLeftIndexOffset(index) { + return this._axesRightToLeftIndexOffsets[index]; + } + get gridVertices() { + return this._gridVertices; + } + get gridIndices() { + return this._gridIndices; + } + getGridTicksIndexCount(index) { + return this._gridTicksIndexCounts[index]; + } + getGridTicksIndexOffset(index) { + return this._gridTicksIndexOffsets[index]; + } + getGridFaceIndexCount(index) { + return this._gridFaceIndexCounts[index]; + } + getGridFaceIndexOffset(index) { + return this._gridFaceIndexOffsets[index]; + } + getGridTicksMMatrix(index) { + return this._gridTicksMMatrices[index]; + } + getGridFaceMMatrix(index) { + return this._gridFaceMMatrices[index]; + } + getGridTicksScale(index) { + return this._gridTicksScales[index]; + } + getGridTicksZero(index) { + return this._gridTicksZeros[index]; + } + get gridFaceZero() { + return this._gridFaceZeros; + } + get gridFaceMinorGridlines() { + return this._gridFaceMinorGridlines; + } + getGridTicksMinorGridlines(index) { + return this._gridTicksMinorGridlines[index]; + } + setTickPositions(index, value) { + if (this._gridTicksPositions[index] != value) { + this._gridTicksPositions[index] = value; + this._hasChanged = true; + } + } + get scalingX() { + return this._scalingX; + } + set scalingX(value) { + if (value != this._scalingX) { + this._scalingX = value; + this._hasChanged = true; + } + } + get scalingY() { + return this._scalingY; + } + set scalingY(value) { + if (value != this._scalingY) { + this._scalingY = value; + this._hasChanged = true; + } + } + get offsetX() { + return this._offset[12]; + } + set offsetX(value) { + if (value != this._offset[12]) this._offset[12] = value; + } + get offsetY() { + return this._offset[13]; + } + set offsetY(value) { + if (value != this._offset[13]) this._offset[13] = value; + } + set rotation(value) { + if (this._rotation != value) { + this._rotation = value; + this._rMatrix = create$7(); + fromQuat(this._rMatrix, value); + } + } + constructor(core) { + super(core); + this._size = create$6(); + this._translation = create$6(); + this._normal = create$6(); + this._forward = create$6(); + this._right = create$6(); + this._up = create$6(); + this._texCoord = create$3(); + this._bounds = create$5(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mat3 = create$8(); + this._isDiscrete = [false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 2; i++) this._isForwardFace.push(false); + for (let i = 0; i < 4; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$6(); + this._textPosition = create$6(); + this._distances = []; + for (let i = 0; i < 4; i++) this._distances.push(0); + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 2; i++) { + this._maxLabelSize.push(create$3()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) this._labelMMatrices.push(create$7()); + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 2; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) this._titleMMatrices.push(create$7()); + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 2; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._headingMMatrices.push(create$7()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$6(); + this._edgePositive = create$6(); + this._edgeNormal = create$6(); + this._edgeNormalTemp = create$6(); + this._edgePositiveTemp = create$6(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 4; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$6()); + this._edgeHorizontalUp.push(create$6()); + this._edgeHorizontalForward.push(create$6()); + this._edgeVerticalRight.push(create$6()); + this._edgeVerticalUp.push(create$6()); + this._edgeVerticalForward.push(create$6()); + } + this.isFaceVisible = []; + for (let i = 0; i < 2; i++) this.isFaceVisible.push(true); + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$6(); + this._gridTicksZeros = []; + this._gridFaceZeros = create$3(); + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = create$3(); + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$6(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 2; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create$3()); + this._gridTicksMinorGridlines.push(create$3()); + this._gridTicksScales.push(create$6()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$7()); + } + for (let i = 0; i < 4; i++) { + this._gridTicksMMatrices.push(create$7()); + this._gridTicksRotations.push(create$7()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Quad$2.EDGE_POSITIVES[i][0]; + _mat4[1] = Quad$2.EDGE_POSITIVES[i][1]; + _mat4[2] = Quad$2.EDGE_POSITIVES[i][2]; + _mat4[4] = Quad$2.EDGE_NORMALS[i][0]; + _mat4[5] = Quad$2.EDGE_NORMALS[i][1]; + _mat4[6] = Quad$2.EDGE_NORMALS[i][2]; + cross$1(this._vec3, Quad$2.EDGE_POSITIVES[i], Quad$2.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null]; + this._toValues = [null, null]; + this.isDivisionPickingEnabled = [false, false]; + this.isLabelPickingEnabled = [false, false]; + this.isTitlePickingEnabled = [false, false]; + this.isHeadingPickingEnabled = [false, false]; + this.isAxisReversed = [false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._offset = create$7(); + } + initialize() { + this._isInitialized = true; + } + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); + const maxBounds = Math.max(this._size[0], this._size[1]); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) this.hasChangedCallback(); + this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); + } + if (this._rMatrix) { + mul(this._mMatrix, this.mMatrix, this._rMatrix); + mul(this._mMatrix, this._mMatrix, this._offset); + } else multiply$2(this._mMatrix, this.mMatrix, this._offset); + this._mvMatrix = create$7(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 2; faceId++) { + transformMat4$2(this._forward, Constants$2.VECTOR3_ZERO, this._mvMatrix); + transformMat3(this._normal, Quad$2.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 4; edgeId++) { + this._isForwardEdge[edgeId] = dot$1(Quad$2.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 2; axisId++) if (this.arePickDivisionsVisible[axisId]) { + set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (this.isEdgeVisible[edgeId]) { + let distance = this._distances[edgeId]; + distance += this._gridPickDivisionHeight * .5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$2.VECTOR3_REFLECTX); + scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance += this._gridPickDivisionHeight * .5; + this._distances[edgeId] = distance; + } + } + } + set$5(this._gridFaceZeros, this.zero[0], this.zero[1]); + set$5(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); + for (let faceId = 0; faceId < 2; faceId++) if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + } + for (let axisId = 0; axisId < 2; axisId++) for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + multiply$1(this._edgePosition, Quad$2.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$5(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross$1(this._right, Constants$2.VECTOR3_UNITY, this._forward); + normalize$5(this._right, this._right); + cross$1(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Quad$2.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Quad$2.EDGE_POSITIVES[edgeId], this._mat3); + copy$6(this._edgeNormalTemp, this._edgeNormal); + copy$6(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) copy$6(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + else { + negate(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$6(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) copy$6(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + else { + negate(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$6(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) this._updateLabels(axisId, edgeId); + if (this._titles[axisId]) this._updateTitle(axisId, edgeId); + } + if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); + } + } + } + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance += maxLabelSize * .5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) multiply$2(labelMMatrix, labelMMatrix, Constants$2.MAT4_ROTATION_MINUS_90); + distance += maxLabelSize * .5; + this._distances[edgeId] = distance; + } + _updateTitle(axisId, edgeId) { + let distance = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance += titleTextSize * .5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance += titleTextSize * .5; + this._distances[edgeId] = distance; + } + _updateHeading(axisId, edgeId) { + let distance = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance += headingTextSize * .5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance += headingTextSize * .5; + this._distances[edgeId] = distance; + } + _updateGrids(size) { + let offset = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const count = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count * 6); + } + for (let axisId = 0; axisId < 2; axisId++) { + const width = size[axisId]; + set$8(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); + offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); + this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; + } + const axisId = 2; + this._gridFaceScale[axisId] = 1; + for (let faceId = 0; faceId < 2; faceId++) offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); + } + _updateText(size) { + let glyphOffset = 0; + let count = 0; + for (let axisId = 0; axisId < 2; axisId++) { + const labels = this._labels[axisId]; + if (labels) for (let i = 0; i < labels.length; i++) count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + const title = this._titles[axisId]; + if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + const heading = this._headings[axisId]; + if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 2; axisId++) if (this._labels[axisId]) { + const width = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set$5(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 2; axisId++) if (this._titles[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 2; axisId++) if (this._headings[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (position - .5) * size, 0, 0); + if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; + else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + maxSize[0] = Math.max(width, maxSize[0]); + maxSize[1] = Math.max(lineHeight, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (position - .5) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; + else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; + maxSize[0] = Math.max(lineHeight, maxSize[0]); + maxSize[1] = Math.max(width, maxSize[1]); + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (.5 - position) * size, 0, 0); + if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; + else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (.5 - position) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; + else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateGridTicks(axisId, dataView, indices, offset) { + this._gridTicksIndexOffsets[axisId] = offset * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$6(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset * 4; + for (let position = 0; position < positions.length - 1; position++) { + const left = isAxisReversed ? 1 - positions[position + 1] - .5 : positions[position] - .5; + const right = isAxisReversed ? 1 - positions[position] - .5 : positions[position + 1] - .5; + axes[axisId] = position + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let j = 0; j < this._indexTemplate.length; j++) indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + set$7(this._bounds, left + .5, 0, right + .5, 1); + this._translation[0] = left; + this._translation[1] = .5; + this._translation[2] = 0; + this._texCoord[0] = left + .5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -.5; + this._texCoord[0] = left + .5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$2.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; + return offset; + } + _updateGridFace(axisId, faceId, dataView, indices, offset) { + set$8(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$6(); + negate(this._normal, Quad$2.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - .5 : positions2[position2] - .5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - .5 : positions2[position2 + 1] - .5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - .5 : positions3[position3] - .5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - .5 : positions3[position3 + 1] - .5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let i = 0; i < this._indexTemplate.length; i++) indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + set$7(this._bounds, min2 + .5, min3 + .5, max2 + .5, max3 + .5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + .5; + this._texCoord[1] = max3 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + .5; + this._texCoord[1] = min3 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + .5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; + return offset; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/font.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Glyph = class { + toJSON() { + return { + key: this.key, + char: this.char, + width: this.width, + height: this.height, + top: this.top, + left: this.left, + advance: this.advance, + u0: this.u0, + v0: this.v0, + u1: this.u1, + v1: this.v1 + }; + } + }; + var FontVisual$2 = class { + update() {} + constructor(font) { + this.font = font; + } + }; + var Font = class { + get atlas() { + return this._rasterizer.fontAtlas; + } + get count() { + return this._chars.size; + } + constructor(core, rasterizer) { + this._core = core; + this._rasterizer = rasterizer; + this._chars = /* @__PURE__ */ new Set(); + this._previousSize = 0; + this.glyphs = {}; + } + addGlyph(char) { + if (!this._chars.has(char)) { + this._chars.add(char); + this._rasterizer.draw(char); + this._hasChanged = true; + } + } + update() { + if (this._hasChanged) { + this._hasChanged = false; + this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); + this._previousSize = this._chars.size; + if (this.hasChangedCallback) this.hasChangedCallback(); + } + } + toJSON() { + const glyphs = []; + for (let key in this.glyphs) { + const glyph = this.glyphs[key]; + glyphs.push(glyph.toJSON()); + } + return { + name: this.name, + size: this.size, + border: this.border, + glyphs, + edgeValue: this.edgeValue + }; + } + }; + var FontAtlas = class { + constructor(width, height) { + const canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + const context = canvas.getContext("2d"); + context.clearRect(0, 0, width, height); + this.imageData = context.getImageData(0, 0, width, height); + this.x = 0; + this.top = new Uint16Array(width); + } + }; + var FontRasterizer = class { + get font() { + return this._font; + } + get fontAtlas() { + return this._fontAtlas; + } + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontAtlas = options.fontAtlas; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._font = new Font(core, this); + this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/gi, "").toLowerCase(); + this._font.size = this._fontSize; + this._font.border = this._border; + this._font.edgeValue = this._edgeValue; + const glyphRasterizerOptions = { + baseline: this._baseline, + border: this._border, + edgeValue: this._edgeValue, + fontFamily: this._fontFamily, + fontSize: this._fontSize, + fontStyle: this._fontStyle, + fontWeight: this._fontWeight, + maxDistance: this._maxDistance + }; + this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); + this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); + } + draw(char) { + const glyph = this._glyphRasterizer.draw(char); + const texWidth = glyph.width + 2 * this._border; + const texHeight = glyph.height + 2 * this._border; + const width = this._fontAtlas.imageData.width; + const height = this._fontAtlas.imageData.height; + if (this._fontAtlas.x + texWidth > width) this._fontAtlas.x = 0; + let y = 0; + for (let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++) y = Math.max(y, this._fontAtlas.top[x]); + if (y + texHeight > height) this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); + for (let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++) this._fontAtlas.top[x] = y + texHeight; + glyph.u0 = this._fontAtlas.x / width; + glyph.v0 = y / height; + glyph.u1 = (this._fontAtlas.x + texWidth) / width; + glyph.v1 = (y + texHeight) / height; + this._font.glyphs[char] = glyph; + for (let i = 0; i < glyph.distances.length; i++) { + const distance = glyph.distances[i]; + const dataX = i % texWidth; + const dataY = Math.floor(i / texWidth); + const offset = (this._fontAtlas.x + dataX + (y + dataY) * width) * 4; + this._fontAtlas.imageData.data[offset + 0] = distance; + this._fontAtlas.imageData.data[offset + 1] = distance; + this._fontAtlas.imageData.data[offset + 2] = distance; + this._fontAtlas.imageData.data[offset + 3] = 255; + } + this._fontAtlas.x += texWidth; + } + }; + var GlyphRasterizer = class { + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._size = this._fontSize + this._border * 2; + this._size += this._border * 2; + this._gridOuter = new Float64Array(this._size * this._size); + this._gridInner = new Float64Array(this._size * this._size); + this._f = new Float64Array(this._size); + this._z = new Float64Array(this._size + 1); + this._v = new Uint16Array(this._size); + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = this._size; + this._context = canvas.getContext("2d", { willReadFrequently: true }); + this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; + this._context.textBaseline = this._baseline; + this._context.textAlign = "left"; + this._context.fillStyle = "black"; + this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); + } + draw(char) { + const textMetrics = this._context.measureText(char); + const glyphLeft = 0; + const glyphTop = Math.floor(textMetrics.actualBoundingBoxAscent); + let glyphWidth = Math.ceil(textMetrics.actualBoundingBoxRight); + let glyphHeight = Math.ceil(textMetrics.actualBoundingBoxAscent) + Math.ceil(textMetrics.actualBoundingBoxDescent); + glyphWidth = Math.min(this._size - this._border, glyphWidth); + glyphHeight = Math.min(this._size - this._border, glyphHeight); + const width = glyphWidth + 2 * this._border; + const height = glyphHeight + 2 * this._border; + const length = width * height; + const distances = new Uint8ClampedArray(length); + const gradientsX = new Uint8ClampedArray(length); + const gradientsY = new Uint8ClampedArray(length); + const pixels = new Uint8ClampedArray(length); + const glyph = new Glyph(); + glyph.char = char; + glyph.key = char.codePointAt(0); + glyph.distances = distances; + glyph.gradientsX = gradientsX; + glyph.gradientsY = gradientsY; + glyph.pixels = pixels; + glyph.width = glyphWidth; + glyph.height = glyphHeight; + glyph.top = glyphTop; + glyph.left = glyphLeft; + glyph.advance = textMetrics.width; + if (glyphWidth == 0 || glyphHeight == 0) return glyph; + this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); + this._context.fillText(char, this._border, this._border + glyphTop); + const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); + for (let i = 0; i < length; i++) { + this._gridOuter[i] = Number.MAX_VALUE; + this._gridInner[i] = 0; + } + for (let y = 0; y < glyphHeight; y++) for (let x = 0; x < glyphWidth; x++) { + const a = imgData.data[4 * (y * glyphWidth + x) + 3] / 255; + if (a > 0) { + const j = (y + this._border) * width + x + this._border; + if (a == 1) { + this._gridOuter[j] = 0; + this._gridInner[j] = Number.MAX_VALUE; + } else { + const d = .5 - a; + this._gridOuter[j] = d > 0 ? d * d : 0; + this._gridInner[j] = d < 0 ? d * d : 0; + pixels[j] = 255; + } + } + } + this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); + this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width, this._f, this._v, this._z); + const distances2 = new Float32Array(length); + for (let i = 0; i < length; i++) { + const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); + distances[i] = Math.round(this._edgeValue - distance * 255 / this._maxDistance); + distances2[i] = distance; + } + for (let i = 0; i < length; i++) { + const x = i % width; + const y = Math.floor(i / width); + const d = distances2[i]; + const sign = d < 0 ? -1 : 1; + const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; + const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; + const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; + const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; + let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; + let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; + gradientsX[i] = Math.round((gradientX * .5 + .5) * 255); + gradientsY[i] = Math.round((gradientY * .5 + .5) * 255); + } + return glyph; + } + _edt(data, x0, y0, width, height, gridSize, f, v, z) { + for (let x = x0; x < x0 + width; x++) this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); + for (let y = y0; y < y0 + height; y++) this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); + } + _edt1d(grid, offset, stride, n, f, v, z) { + v[0] = 0; + z[0] = -Number.MAX_VALUE; + z[1] = Number.MAX_VALUE; + f[0] = grid[offset]; + for (let q = 1, k = 0, s = 0; q < n; q++) { + f[q] = grid[offset + q * stride]; + const q2 = q * q; + do { + const r = v[k]; + s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; + } while (s <= z[k] && --k > -1); + k++; + v[k] = q; + z[k] = s; + z[k + 1] = Number.MAX_VALUE; + } + for (let q = 0, k = 0; q < n; q++) { + while (z[k + 1] < q) k++; + const r = v[k]; + const qr = q - r; + grid[offset + q * stride] = f[r] + qr * qr; + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/input/manipulationprocessor.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ManipulationProcessor = class { + get manipulators() { + return this._manipulators; + } + get count() { + return this._count; + } + get isDragging() { + return this._isDragging; + } + constructor(core) { + this._core = core; + this._count = 0; + this._centroid = create$6(); + this._previousCentroid = create$6(); + this._relativePositionToCentroid = create$6(); + this._directionToCentroid = create$6(); + this._previousDirectionToCentroid = create$6(); + this._manipulators = {}; + this._removedManipulators = []; + this.cumulativeTranslation = create$6(); + this.translationDelta = create$6(); + this.centroid = create$6(); + this.maxScale = Number.MAX_VALUE; + this.twistAxis = fromValues$3(0, 0, 1); + this.initialize(); + } + update(elapsedTime, manipulators) { + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + if (!manipulators[manipulator.id]) { + if (this.removeManipulator) this.removeManipulator(manipulator); + this._removedManipulators.push(manipulator.id); + } + } + if (this._removedManipulators.length > 0) { + for (let i = 0; i < this._removedManipulators.length; i++) { + delete this._manipulators[this._removedManipulators[i]]; + this._count--; + } + this._removedManipulators = []; + } + for (const key in manipulators) { + const manipulator = manipulators[key]; + if (!this._manipulators[manipulator.id]) { + if (!this.addManipulator || this.addManipulator(manipulator)) { + copy$6(manipulator.initialPosition, manipulator.position); + this._manipulators[manipulator.id] = manipulator; + this._count++; + } + } + } + set$8(this.translationDelta, 0, 0, 0); + this.scaleDelta = 0; + this.twistDelta = 0; + if (this._count > 0) if (this._previousCount > 0) { + if (this.prepareManipulation) this.prepareManipulation(); + this._process(); + if (this.processManipulation) this.processManipulation(elapsedTime); + } else { + this.initialize(); + if (this.beginManipulation) this.beginManipulation(); + } + else if (this._previousCount > 0) { + if (this.endManipulation) this.endManipulation(); + } + this._isDragging = this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; + this._previousCount = this._count; + } + initialize() { + set$8(this.centroid, 0, 0, 0); + set$8(this.cumulativeTranslation, 0, 0, 0); + this.cumulativeScale = 1; + this.cumulativeTwist = 0; + } + _process() { + if (this._previousCount > 0) { + let persisted = 0; + for (const key in this._manipulators) if (this._manipulators[key].isPersisted) persisted++; + const removed = this._previousCount - persisted; + if (persisted > 0) { + if (removed > 0) copy$6(this._centroid, this._previousCentroid); + else { + set$8(this._centroid, 0, 0, 0); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + if (manipulator.isPersisted) add$4(this._centroid, this._centroid, manipulator.position); + } + scale$5(this._centroid, this._centroid, 1 / persisted); + } + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + if (manipulator.isPersisted) { + manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); + add$4(this.translationDelta, this.translationDelta, manipulator.position); + subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); + subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); + const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); + if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) this.scaleDelta += 1; + else { + const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); + const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); + const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); + this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; + scale$5(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); + scale$5(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); + this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); + } + } + } + scale$5(this.translationDelta, this.translationDelta, 1 / persisted); + add$4(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); + this.scaleDelta /= persisted; + this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); + this.scaleDelta -= 1; + this.twistDelta /= persisted; + this.cumulativeTwist += this.twistDelta; + } + } + set$8(this.centroid, 0, 0, 0); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + add$4(this.centroid, this.centroid, manipulator.position); + } + scale$5(this.centroid, this.centroid, 1 / this._count); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); + } + copy$6(this._previousCentroid, this.centroid); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + manipulator.isPersisted = true; + copy$6(manipulator.previousPosition, manipulator.position); + copy$6(manipulator.previousRotationAxis, manipulator.rotationAxis); + copy$6(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/input/mousewheel.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var MouseWheel = class { + constructor(core) { + this._core = core; + this._previousTotal = 0; + this.total = 0; + } + initialize(element) { + element.addEventListener("wheel", (e) => { + e.preventDefault(); + const wheelEvent = e; + this.total += wheelEvent.deltaY; + }, { passive: false }); + } + update(elapsedTime) { + const total = this.total; + this.delta = total - this._previousTotal; + this._previousTotal = total; + if (this._core.config.isDebugVisible) this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/input/manipulator.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Manipulator = class { + constructor() { + this.pickedIndex = 0; + this.maxTranslationSquared = 0; + this.initialPosition = create$6(); + this.position = create$6(); + this.previousPosition = create$6(); + this.holdOrigin = create$6(); + this.positionRelativeToCentroid = create$6(); + this.previousPositionRelativeToCentroid = create$6(); + this.rotationAxis = create$6(); + this.previousRotationAxis = create$6(); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/input/pointers.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Pointers = class { + get hoverX() { + return this._hoverX; + } + get hoverY() { + return this._hoverY; + } + get hoverId() { + return this._hoverId; + } + constructor(core, manipulators) { + this._core = core; + this._manipulators = manipulators; + } + initialize(element) { + this._element = element; + element.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); + element.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); + element.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); + element.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); + element.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); + element.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); + } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); + this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); + } + } + _handlePointerDown(e) { + this._element.focus(); + const devicePixelRatio = this._core.renderer.devicePixelRatio; + const manipulator = new Manipulator(); + const id = e.pointerId; + const x = e.offsetX * devicePixelRatio; + const y = e.offsetY * devicePixelRatio; + manipulator.id = id; + manipulator.position[0] = x; + manipulator.position[1] = y; + manipulator.type = e.pointerType; + manipulator.button = e.button; + manipulator.shiftKey = e.shiftKey; + manipulator.ctrlKey = e.ctrlKey; + manipulator.altKey = e.altKey; + manipulator.event = e; + this._manipulators[id] = manipulator; + this._hoverId = id; + this._hoverX = x; + this._hoverY = y; + } + _handlePointerMove(e) { + const devicePixelRatio = this._core.renderer.devicePixelRatio; + const x = e.offsetX * devicePixelRatio; + const y = e.offsetY * devicePixelRatio; + const id = e.pointerId; + const manipulator = this._manipulators[id]; + if (manipulator) { + manipulator.position[0] = x; + manipulator.position[1] = y; + manipulator.event = e; + } + switch (e.pointerType) { + case "mouse": + this._hoverId = id; + this._hoverX = x; + this._hoverY = y; + break; + case "pen": + this._hoverId = id; + this._hoverX = x; + this._hoverY = y; + this._tiltX = e.tiltX; + this._tiltY = e.tiltY; + this._twist = e.twist; + break; + } + } + _handlePointerUp(e) { + const manipulator = this._manipulators[e.pointerId]; + if (manipulator) manipulator.event = e; + this._remove(e.pointerId); + } + _handlePointerCancel(e) { + this._remove(e.pointerId); + } + _handlePointerLeave(e) { + this._resetHover(); + this._remove(e.pointerId); + } + _handlePointerOut(e) { + this._resetHover(); + this._remove(e.pointerId); + } + _resetHover() { + this._hoverId = null; + this._hoverX = null; + this._hoverY = null; + } + _remove(pointerId) { + if (this._manipulators[pointerId]) delete this._manipulators[pointerId]; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/animation.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AnimationHelper = class { + static smoothStep(value) { + return value * value * (3 - 2 * value); + } + static damp(value, target, threshold, dampening) { + if (Math.abs(target) < threshold) return MathHelper.lerp(value, 0, dampening); + else return MathHelper.lerp(value, target, dampening); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/input/keyboard.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Keyboard = class { + constructor(core) { + this._core = core; + this._pressedKeys = /* @__PURE__ */ new Set(); + this._previousPressedKeys = /* @__PURE__ */ new Set(); + } + initialize(element) { + element.addEventListener("keydown", (e) => { + this._handleKeyDown(e); + }, false); + element.addEventListener("keyup", (e) => { + this._handleKeyUp(e); + }, false); + } + update(elapsedTime) { + if (this._core.config.isDebugVisible) this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + } + isKeyDown(key) { + return this._pressedKeys.has(key); + } + wasKeyReleased(key) { + if (this._pressedKeys.has(key)) { + if (!this._previousPressedKeys.has(key)) { + this._previousPressedKeys.add(key); + return true; + } + } else this._previousPressedKeys.delete(key); + return false; + } + _handleKeyDown(e) { + const key = e.key; + if (!this._pressedKeys.has(key)) this._pressedKeys.add(key); + } + _handleKeyUp(e) { + const key = e.key; + if (this._pressedKeys.has(key)) this._pressedKeys.delete(key); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/input/manager.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Manager = class { + constructor(core) { + this._manipulators = {}; + this._core = core; + this._vec3 = create$6(); + this._manipulationProcessor = new ManipulationProcessor(core); + this._manipulators = {}; + this._pointers = new Pointers(core, this._manipulators); + this._pointers.initialize(core.container); + this._mouseWheel = new MouseWheel(core); + this._mouseWheel.initialize(core.container); + this._keyboard = new Keyboard(core); + this._keyboard.initialize(core.container); + this.isPickingEnabled = true; + this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; + this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; + this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; + this.pickHoldDelay = this._core.config.pickHoldDelay; + this.pickSelectDelay = this._core.config.pickSelectDelay; + const rightButton = 2; + this.singleTouchAction = (manipulator) => { + if (manipulator.type == "mouse" && manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return SingleTouchAction.translate; + else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton) return SingleTouchAction.lasso; + else return SingleTouchAction.rotate; + }; + this.mouseWheelAction = (keyboard) => { + if (this._keyboard.isKeyDown("Control")) return MouseWheelAction.rotateY; + else return MouseWheelAction.zoom; + }; + this.lassoPickType = PickType.data; + this._thumbstickX = 0; + this._previousControllerButtonPressed = [ + false, + false, + false, + false + ]; + this._quat0 = create$4(); + this._quat1 = create$4(); + } + update(elapsedTime, xrFrame) { + if (xrFrame) { + const inputSources = this._core.webXRSession.inputSources; + if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { + const inputSource = inputSources[0]; + const controllerVisual = this._core.renderer.controllers[0]; + if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { + const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); + if (gripPose) controllerVisual.mMatrix = gripPose.transform.matrix; + const gamepad = inputSource.gamepad; + this._core.renderer.isPickingEnabled = false; + const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); + if (rayPose) { + controllerVisual.rayMMatrix = rayPose.transform.matrix; + if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { + this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; + this._core.renderer.isPickingEnabled = true; + } + } + const threshold = .2; + const dampening = Math.min(.015 * elapsedTime, 1); + this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold, dampening); + if (this._thumbstickX != 0) { + setAxisAngle(this._quat0, Constants$2.VECTOR3_UNITY, .01 * this._thumbstickX * elapsedTime); + this._core.getModelRotation(this._quat1); + multiply(this._quat1, this._quat0, this._quat1); + this._core.setModelRotation(this._quat1, true); + } + if (gamepad.buttons[2].pressed) { + if (!this._previousControllerButtonPressed[2]) { + this._previousControllerButtonPressed[2] = true; + if (this.controllerButtonPressedCallback) this.controllerButtonPressedCallback(2); + } + } else this._previousControllerButtonPressed[2] = false; + } + } + } else { + const camera = this._core.camera; + this._manipulationProcessor.update(elapsedTime, this._manipulators); + this._pointers.update(elapsedTime); + this._mouseWheel.update(elapsedTime); + this._keyboard.update(elapsedTime); + if (this._mouseWheel.delta != 0) switch (this.mouseWheelAction(this._keyboard)) { + case MouseWheelAction.zoom: + if (this._pointers.hoverX, this._pointers.hoverY) camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); + break; + case MouseWheelAction.rotateY: + setAxisAngle(this._quat0, Constants$2.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); + camera.getOrbit(this._quat1); + multiply(this._quat1, this._quat1, this._quat0); + camera.setOrbit(this._quat1, true); + break; + } + const count = this._manipulationProcessor.count; + if (count == 0) { + if (this._isLassoPicking) { + this._isLassoPicking = false; + this._core.renderer.isLassoPicking = false; + const x0 = Math.min(this._lassoX0, this._lassoX1); + const y0 = Math.min(this._lassoY0, this._lassoY1); + const x1 = Math.max(this._lassoX0, this._lassoX1); + const y1 = Math.max(this._lassoY0, this._lassoY1); + if (x1 - x0 > 0 && y1 - y0 > 0) { + const sets = this._core.pickLasso(x0, y0, x1, y1, this.lassoPickType); + const result = { + x0, + y0, + x1, + y1, + pickType: this.lassoPickType, + ids: sets, + manipulator: this._manipulator + }; + this.pickLassoCallback(result); + } + } + } else if (count == 1) { + const translationDelta = this._manipulationProcessor.translationDelta; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + const manipulators = this._manipulationProcessor.manipulators; + for (const key in manipulators) { + const manipulator = manipulators[key]; + switch (this.singleTouchAction(manipulator)) { + case SingleTouchAction.rotate: + camera.rotate(translationDelta); + break; + case SingleTouchAction.translate: + camera.translate(translationDelta); + break; + case SingleTouchAction.lasso: + if (this.pickLassoCallback) { + if (!this._isLassoPicking) { + this._isLassoPicking = true; + this._core.renderer.isLassoPicking = true; + this._lassoX0 = manipulator.position[0]; + this._lassoY0 = manipulator.position[1]; + } + this._lassoX1 = manipulator.position[0]; + this._lassoY1 = manipulator.position[1]; + this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); + this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); + } + break; + } + break; + } + } + } else { + const translationDelta = this._manipulationProcessor.translationDelta; + const camera = this._core.camera; + if (translationDelta[0] != 0 || translationDelta[1] != 0) camera.translate(translationDelta); + if (this._manipulationProcessor.scaleDelta != 0) { + const distance = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; + camera.zoom(distance, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + if (this._manipulationProcessor.twistDelta != 0) camera.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { + const camera = this._core.camera; + const renderer = this._core.renderer; + if (renderer.isCapturingPickImage) { + camera.updatePickVMatrix(renderer.width / 2, renderer.height / 2); + renderer.pickVMatrix = camera.pickVMatrix; + renderer.isPickingEnabled = true; + this._pickedTime = 0; + } else if (this._pointers.hoverId > -1) { + const pickingX = this._pointers.hoverX; + const pickingY = this._pointers.hoverY; + camera.updatePickVMatrix(pickingX, pickingY); + renderer.pickVMatrix = camera.pickVMatrix; + renderer.isPickingEnabled = true; + if (this._pickedId != renderer.pickedId) { + this._pickedId = renderer.pickedId; + this._pickedTime = 0; + } else if (this._manipulationProcessor.count == 1) { + this._pickedTime += elapsedTime; + for (const key in this._manipulators) { + this._manipulator = this._manipulators[key]; + break; + } + } + if (this._pickedTime > 0) switch (renderer.pickedType) { + case PickType.data: + if (this._pickedTime > this.pickHoldDelay) { + renderer.getVertexPosition(this._vec3, this._pickedId); + this._core.setModelManipulationOrigin(this._vec3); + this._pickedTime = 0; + } else if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) for (let i = 0; i < renderer.transitionBuffers.length; i++) { + const id = renderer.transitionBuffers[i].pickIdLookup[this._pickedId]; + if (id > -1) { + const result = { + transitionBuffer: i, + id, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); + if (this.pickItemCallback) this.pickItemCallback(result); + break; + } + } + this._pickedTime = 0; + } + break; + case PickType.label: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) for (let i = 0; i < renderer.labelSets.length; i++) { + const id = renderer.labelSets[i].label.pickIdLookup[this._pickedId]; + if (id > -1) { + const result = { + label: id, + set: i, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); + if (this.pickLabelSetCallback) this.pickLabelSetCallback(result); + break; + } + } + this._pickedTime = 0; + } + break; + case PickType.axesDivision: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickGridLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickGrid(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); + if (this.pickAxesGridCallback) this.pickAxesGridCallback(result); + break; + } + } + this._pickedTime = 0; + } + break; + case PickType.axesTitle: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickTitleLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickTitle(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); + if (this.pickAxesTitleCallback) this.pickAxesTitleCallback(result); + break; + } + } + this._pickedTime = 0; + } + break; + case PickType.axesLabel: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickLabelLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickLabel(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); + if (this.pickAxesLabelCallback) this.pickAxesLabelCallback(result); + break; + } + } + this._pickedTime = 0; + } + break; + case PickType.axesHeading: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickHeadingLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickHeading(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); + if (this.pickAxesHeadingCallback) this.pickAxesHeadingCallback(result); + break; + } + } + this._pickedTime = 0; + } + break; + } + } else { + renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } else { + this._core.renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); + this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/log.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Log$1 = class { + constructor(core) { + this._core = core; + } + write(level, value) { + if (level >= this._core.config.logLevel) switch (level) { + case LogLevel.trace: + console.trace(value); + break; + case LogLevel.debug: + console.debug(value); + break; + case LogLevel.info: + console.info(value); + break; + case LogLevel.warn: + console.warn(value); + break; + case LogLevel.error: + console.error(value); + break; + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/main.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter$6 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + 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) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var Core = class { + get container() { + return this._container; + } + get started() { + return this._started; + } + get debugText() { + return this._debugText; + } + get log() { + return this._log; + } + get totalFrames() { + return this._fps.totalFrames; + } + get camera() { + return this._camera; + } + set camera(value) { + this._camera = value; + } + getModelRotation(value) { + copy$4(value, this._modelRotation); + } + setModelRotation(value, isSmooth) { + copy$4(this._modelRotation, value); + if (!isSmooth) copy$4(this._smoothedModelRotation, this._modelRotation); + } + getModelScale() { + return this._modelScale[0]; + } + setModelScale(value, isSmooth) { + set$8(this._modelScale, value, value, value); + if (!isSmooth) copy$6(this._smoothedModelScale, this._modelScale); + } + getModelManipulationOrigin(value) { + copy$6(value, this._modelManipulationOrigin); + } + setModelManipulationOrigin(value) { + this._updateManipulationOrigin(value); + } + getModelPosition(value) { + copy$6(value, this._modelPosition); + } + setModelPosition(value, isSmooth) { + copy$6(this._modelPosition, value); + if (!isSmooth) copy$6(this._smoothedModelPosition, this._modelPosition); + } + get webXRSession() { + return this._webXRSession; + } + get renderer() { + return this._renderer; + } + set renderer(renderer) { + if (this._renderer == renderer) return; + if (this._renderer) { + this.stop(); + this._renderer.remove(); + } + if (!renderer.isInitialized) renderer.initialize(this); + if (this._renderer) { + renderer.transitionTime = this._renderer.transitionTime; + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const previousTransitionBuffer = this._renderer.transitionBuffers[i]; + const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); + transitionBuffer.copyFrom(previousTransitionBuffer); + renderer.transitionBuffers.push(transitionBuffer); + } + const currentAxes = this._renderer.currentAxes; + if (currentAxes) { + renderer.currentAxes = []; + for (let i = 0; i < currentAxes.length; i++) { + const axes = currentAxes[i].axes; + if (axes instanceof Cartesian3dAxes) { + const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); + renderer.currentAxes.push(cartesian3dAxesVisual); + } else if (axes instanceof Cartesian2dAxes) renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); + } + } + const labelSets = this._renderer.labelSets; + if (labelSets) { + renderer.labelSets = []; + for (let i = 0; i < labelSets.length; i++) renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); + } + const images = this._renderer.images; + if (images) { + renderer.images = []; + for (let i = 0; i < images.length; i++) renderer.images.push(renderer.createImageVisual(images[i].image)); + } + const fonts = this._renderer.fonts; + if (fonts) for (const key in fonts) { + const font = fonts[key].font; + renderer.fonts[font.name] = renderer.createFontVisual(font); + } + } else renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); + if (this._renderer) this._renderer.finalize(); + this._renderer = renderer; + this._fps.reset(); + this.start(); + } + get font() { + return this._font; + } + get paletteResources() { + return this._paletteResources; + } + get config() { + return this._config; + } + get inputManager() { + return this._inputManager; + } + constructor(options) { + setMatrixArrayType(Array); + this._vec3 = create$6(); + this._quat = create$4(); + this._mat4 = create$7(); + this._container = options && options.container ? options.container : document.body; + this._config = new Config$2(this); + this._log = new Log$1(this); + this._debugText = new DebugText(); + this._inputManager = options && options.useInputManager === false ? null : new Manager(this); + const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { + fontAtlas: new FontAtlas(256, 512), + fontSize: 24, + border: 3, + fontFamily: "\"segoe ui semibold\", sans-serif", + fontWeight: "normal", + fontStyle: "normal", + baseline: "alphabetic", + maxDistance: 8, + edgeValue: 192 + }; + const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); + this._font = fontRasterizer.font; + this._paletteResources = new PaletteResources(); + this._previousTime = 0; + this._fps = new Fps(this); + this._modelMMatrix = create$7(); + this._modelPosition = create$6(); + this._modelRotation = create$4(); + this._modelScale = create$6(); + this._smoothedModelPosition = create$6(); + this._smoothedModelRotation = create$4(); + this._smoothedModelScale = create$6(); + this._modelManipulationOrigin = create$6(); + this._camera = new AltAzimuthCamera(this); + this.resetModel(false); + } + getView(view) { + this.getModelPosition(view.position); + this.getModelRotation(view.rotation); + view.scale = this.getModelScale(); + } + setView(view, isSmooth) { + this.setModelPosition(view.position, isSmooth); + this.setModelRotation(view.rotation, isSmooth); + this.setModelScale(view.scale, isSmooth); + } + lerpView(from, to, time) { + lerp$1(this._vec3, from.position, to.position, time); + this.setModelPosition(this._vec3, false); + slerp(this._quat, from.rotation, to.rotation, time); + this.setModelRotation(this._quat, false); + this.setModelScale(MathHelper.lerp(from.scale, to.scale, time), false); + } + resetModel(isSmooth) { + set$8(this._modelPosition, 0, 0, -this._config.modelDistance); + set$8(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); + set$6(this._modelRotation, 0, 0, 0, 1); + if (!isSmooth) this._syncSmooth(); + } + resetManipulationOrigin() { + if (!exactEquals$1(this._modelManipulationOrigin, Constants$2.VECTOR3_ZERO)) this._updateManipulationOrigin(Constants$2.VECTOR3_ZERO); + } + reset(isSmooth) { + this.resetModel(isSmooth); + this.resetManipulationOrigin(); + this._camera.reset(isSmooth); + } + start() { + if (!this._started && this._renderer) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + this._started = true; + this._log.write(LogLevel.info, "render loop started"); + if (this.startCallback) this.startCallback(); + } + } + stop() { + if (this._started) { + this._started = false; + if (this._windowAnimationFrame != null) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + this._log.write(LogLevel.info, "render loop stopped"); + } + if (this.stopCallback) this.stopCallback(); + } + } + checkWebXRSupport() { + const xrSystem = navigator.xr; + if (xrSystem) xrSystem.isSessionSupported("immersive-vr").then((supported) => { + if (supported) { + this._log.write(LogLevel.info, "WebXR supported"); + if (this.webXRSupportedCallback) this.webXRSupportedCallback(); + } + }); + } + requestWebXRSession() { + if (this._webXRSession) this._webXRSession.end(); + else navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); + } + _webXRSessionStarted(session) { + if (this.webXRSessionStartedCallback) this.webXRSessionStartedCallback(); + this._webXRSession = session; + session.onend = () => this._webXRSessionEnded(); + this._renderer.initializeWebXR(session).then(() => { + if (this._windowAnimationFrame) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + } + session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + }); + session.oninputsourceschange = (event) => this._webXRInputSourcesChanged(event); + } + _webXRSessionEnded() { + if (this.webXRSessionEndedCallback) this.webXRSessionEndedCallback(); + this._webXRSession = null; + this._renderer.controllers.length = 0; + this.start(); + } + _webXRInputSourcesChanged(event) { + if (event.added.length > 0) { + const added = event.added[0]; + if (added.targetRayMode == "tracked-pointer") { + const profiles = added.profiles; + const handedness = added.handedness; + if (this.webXRInputSourceRequestCallback) this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { + const options = { + profiles, + handedness, + obj: response.obj, + texture: response.texture + }; + const controller = new Controller(this, options); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + }, (e) => { + this._log.write(LogLevel.error, e); + }); + else { + const controller = new Controller(this, {}); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + } + } + } + if (event.removed.length > 0) this.renderer.controllers.length = 0; + } + _tick(currentTime, xrFrame) { + return __awaiter$6(this, void 0, void 0, function* () { + let elapsedTime = currentTime - this._previousTime; + this._previousTime = currentTime; + if (elapsedTime > 0) { + this.update(elapsedTime, xrFrame); + yield this.render(elapsedTime, xrFrame); + } + if (xrFrame) xrFrame.session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + else if (this._started) this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + }); + } + update(elapsedTime, xrFrame) { + this._renderer.setSize(elapsedTime); + if (this.updateCallback) this.updateCallback(elapsedTime, xrFrame); + if (this._config.isDebugVisible) this._debugText.clear(); + this._fps.update(elapsedTime); + if (this._inputManager) { + this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; + this._inputManager.update(elapsedTime, xrFrame); + } + let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); + lerp$1(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); + amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); + slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); + amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); + lerp$1(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); + fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); + this._renderer.mMatrix = this._modelMMatrix; + if (this._config.isDebugVisible) { + this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); + this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); + this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); + this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); + this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); + this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); + this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); + } + if (!xrFrame) { + this._camera.width = this._renderer.width; + this._camera.height = this._renderer.height; + this._camera.modelMMatrix = this._modelMMatrix; + this._camera.modelPosition = this._smoothedModelPosition; + this._camera.modelRotation = this._smoothedModelRotation; + this._camera.modelScale = this._smoothedModelScale; + this._camera.modelManipulationOrigin = this._modelManipulationOrigin; + this._camera.update(elapsedTime); + this._renderer.vMatrices = this._camera.vMatrices; + this._renderer.mvMatrices = this._camera.mvMatrices; + this._renderer.pMatrices = this._camera.pMatrices; + this._renderer.inverseVMatrices = this._camera.inverseVMatrices; + this._renderer.inversePMatrices = this._camera.inversePMatrices; + } + this._renderer.prepare(xrFrame); + if (!xrFrame && this._config.stereoMode == StereoMode.none) this._renderer.pickPMatrix = this._camera.pMatrices[0]; + else { + const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); + perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); + this._renderer.pickPMatrix = this._mat4; + } + if (this._renderer.isInitialized) this._renderer.update(elapsedTime); + } + render(elapsedTime, xrFrame) { + return __awaiter$6(this, void 0, void 0, function* () { + this._fps.render(); + if (this._renderer.isInitialized) { + yield this._renderer.render(elapsedTime, xrFrame); + if (this.afterRenderCallback) this.afterRenderCallback(); + } + }); + } + _syncSmooth() { + copy$6(this._smoothedModelPosition, this._modelPosition); + copy$6(this._smoothedModelScale, this._modelScale); + copy$4(this._smoothedModelRotation, this._modelRotation); + } + _updateManipulationOrigin(position) { + this._log.write(LogLevel.info, `manipulation origin ${position[0].toFixed(3)},${position[1].toFixed(3)},${position[2].toFixed(3)}`); + this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position); + copy$6(this._modelManipulationOrigin, position); + transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); + subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); + copy$6(this._smoothedModelPosition, this._modelPosition); + if (this.manipulationOriginChangedCallback) { + const result = { + x: position[0], + y: position[1], + z: position[2] + }; + this.manipulationOriginChangedCallback(result); + } + } + pickLasso(x0, y0, x1, y1, pickType) { + const inverseMMatrix = create$7(); + invert$1(inverseMMatrix, this._modelMMatrix); + const sets = []; + const nearPositions = [ + create$6(), + create$6(), + create$6(), + create$6() + ]; + const farPositions = [ + create$6(), + create$6(), + create$6(), + create$6() + ]; + const directions = [ + create$6(), + create$6(), + create$6(), + create$6() + ]; + this._camera.unproject(nearPositions[0], x0, y1, -1); + this._camera.unproject(farPositions[0], x0, y1, 1); + this._camera.unproject(nearPositions[1], x1, y1, -1); + this._camera.unproject(farPositions[1], x1, y1, 1); + this._camera.unproject(nearPositions[2], x1, y0, -1); + this._camera.unproject(farPositions[2], x1, y0, 1); + this._camera.unproject(nearPositions[3], x0, y0, -1); + this._camera.unproject(farPositions[3], x0, y0, 1); + for (let i = 0; i < 4; i++) { + transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); + transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); + subtract(directions[i], farPositions[i], nearPositions[i]); + normalize$5(directions[i], directions[i]); + } + const normals = [ + create$6(), + create$6(), + create$6(), + create$6() + ]; + const d = []; + for (let i = 0; i < 4; i++) { + cross$1(normals[i], directions[(i + 1) % 4], directions[i]); + normalize$5(normals[i], normals[i]); + d.push(-dot$1(normals[i], nearPositions[i])); + } + if (pickType == PickType.data) { + const translation = create$6(); + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const transitionBuffer = this._renderer.transitionBuffers[i]; + const set = /* @__PURE__ */ new Set(); + if (transitionBuffer.isVisible) { + const start = window.performance.now(); + const currentBuffer = transitionBuffer.currentBuffer; + const lookup = currentBuffer.lookup; + for (let j = 0; j < currentBuffer.length; j++) { + const id = currentBuffer.ids[j]; + const index = lookup[id]; + if (index != null) { + UnitVertex.getTranslation(currentBuffer.dataView, index, translation); + let isInside = true; + for (let k = 0; k < 4; k++) { + let distance = dot$1(normals[k], translation); + distance += d[k]; + if (distance < 0) { + isInside = false; + break; + } + } + if (isInside) set.add(id); + } + } + if (set.size > 0) this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set.size} ${Math.round(window.performance.now() - start)}ms`); + } + sets.push(set); + } + } + return sets; + } + }; + var StereoMode = { + none: "none", + split: "split", + anaglyph: "anaglyph", + left: "left", + right: "right" + }; + var HorizontalAlignment = { + left: "left", + center: "center", + right: "right" + }; + var VerticalAlignment = { + top: "top", + center: "center", + bottom: "bottom" + }; + var AxesTextOrientation = { + parallel: "parallel", + perpendicular: "perpendicular" + }; + var AxesVisibility = { + none: "none", + current: "current", + previous: "previous" + }; + var PickType = { + none: 0, + data: 1, + label: 2, + axesDivision: 3, + axesTitle: 4, + axesLabel: 5, + axesHeading: 6 + }; + var Theme = { + dark: "dark", + light: "light" + }; + var HighlightMode = { + luminance: "luminance", + color: "color" + }; + var UnitType = { + block: "block", + blockSdf: "blockSdf", + boxFrameSdf: "boxFrameSdf", + sphere: "sphere", + sphereSdf: "sphereSdf", + cylinder: "cylinder", + cylinderSdf: "cylinderSdf", + hexPrism: "hexPrism", + hexPrismSdf: "hexPrismSdf", + sdf: "sdf", + disk: "disk", + ringSdf: "ringSdf", + tubeSdf: "tubeSdf" + }; + var SingleTouchAction = { + none: "none", + translate: "translate", + rotate: "rotate", + lasso: "lasso" + }; + var MouseWheelAction = { + none: "none", + zoom: "zoom", + rotateY: "rotateY" + }; + var LogLevel = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4 + }; + var Edge3D = { + topFront: 0, + topRight: 1, + topBack: 2, + topLeft: 3, + bottomFront: 4, + bottomRight: 5, + bottomBack: 6, + bottomLeft: 7, + frontRight: 8, + backRight: 9, + backLeft: 10, + frontLeft: 11 + }; + var HexOrientation = { + pointyTop: "pointyTop", + flatTop: "flatTop" + }; + var RenderMode = { + color: "color", + hdr: "hdr", + depth: "depth", + normal: "normal", + segment: "segment", + edge: "edge" + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/colors.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ColorResources = class {}; + ColorResources.colors = { + "mediumvioletred": [ + 199, + 21, + 133 + ], + "deeppink": [ + 255, + 20, + 147 + ], + "palevioletred": [ + 219, + 112, + 147 + ], + "hotpink": [ + 255, + 105, + 180 + ], + "lightpink": [ + 255, + 182, + 193 + ], + "pink": [ + 255, + 192, + 203 + ], + "darkred": [ + 139, + 0, + 0 + ], + "red": [ + 255, + 0, + 0 + ], + "firebrick": [ + 178, + 34, + 34 + ], + "crimson": [ + 220, + 20, + 60 + ], + "indianred": [ + 205, + 92, + 92 + ], + "lightcoral": [ + 240, + 128, + 128 + ], + "salmon": [ + 250, + 128, + 114 + ], + "darksalmon": [ + 233, + 150, + 122 + ], + "lightsalmon": [ + 255, + 160, + 122 + ], + "orangered": [ + 255, + 69, + 0 + ], + "tomato": [ + 255, + 99, + 71 + ], + "darkorange": [ + 255, + 140, + 0 + ], + "coral": [ + 255, + 127, + 80 + ], + "orange": [ + 255, + 165, + 0 + ], + "darkkhaki": [ + 189, + 183, + 107 + ], + "gold": [ + 255, + 215, + 0 + ], + "khaki": [ + 240, + 230, + 140 + ], + "peachpuff": [ + 255, + 218, + 185 + ], + "yellow": [ + 255, + 255, + 0 + ], + "palegoldenrod": [ + 238, + 232, + 170 + ], + "moccasin": [ + 255, + 228, + 181 + ], + "papayawhip": [ + 255, + 239, + 213 + ], + "lightgoldenrodyellow": [ + 250, + 250, + 210 + ], + "lemonchiffon": [ + 255, + 250, + 205 + ], + "lightyellow": [ + 255, + 255, + 224 + ], + "maroon": [ + 128, + 0, + 0 + ], + "brown": [ + 165, + 42, + 42 + ], + "saddlebrown": [ + 139, + 69, + 19 + ], + "sienna": [ + 160, + 82, + 45 + ], + "chocolate": [ + 210, + 105, + 30 + ], + "darkgoldenrod": [ + 184, + 134, + 11 + ], + "peru": [ + 205, + 133, + 63 + ], + "rosybrown": [ + 188, + 143, + 143 + ], + "goldenrod": [ + 218, + 165, + 32 + ], + "sandybrown": [ + 244, + 164, + 96 + ], + "tan": [ + 210, + 180, + 140 + ], + "burlywood": [ + 222, + 184, + 135 + ], + "wheat": [ + 245, + 222, + 179 + ], + "navajowhite": [ + 255, + 222, + 173 + ], + "bisque": [ + 255, + 228, + 196 + ], + "blanchedalmond": [ + 255, + 235, + 205 + ], + "cornsilk": [ + 255, + 248, + 220 + ], + "darkgreen": [ + 0, + 100, + 0 + ], + "green": [ + 0, + 128, + 0 + ], + "darkolivegreen": [ + 85, + 107, + 47 + ], + "forestgreen": [ + 34, + 139, + 34 + ], + "seagreen": [ + 46, + 139, + 87 + ], + "olive": [ + 128, + 128, + 0 + ], + "olivedrab": [ + 107, + 142, + 35 + ], + "mediumseagreen": [ + 60, + 179, + 113 + ], + "limegreen": [ + 50, + 205, + 50 + ], + "lime": [ + 0, + 255, + 0 + ], + "springgreen": [ + 0, + 255, + 127 + ], + "mediumspringgreen": [ + 0, + 250, + 154 + ], + "darkseagreen": [ + 143, + 188, + 143 + ], + "mediumaquamarine": [ + 102, + 205, + 170 + ], + "yellowgreen": [ + 154, + 205, + 50 + ], + "lawngreen": [ + 124, + 252, + 0 + ], + "chartreuse": [ + 127, + 255, + 0 + ], + "lightgreen": [ + 144, + 238, + 144 + ], + "greenyellow": [ + 173, + 255, + 47 + ], + "palegreen": [ + 152, + 251, + 152 + ], + "teal": [ + 0, + 128, + 128 + ], + "darkcyan": [ + 0, + 139, + 139 + ], + "lightseagreen": [ + 32, + 178, + 170 + ], + "cadetblue": [ + 95, + 158, + 160 + ], + "darkturquoise": [ + 0, + 206, + 209 + ], + "mediumturquoise": [ + 72, + 209, + 204 + ], + "turquoise": [ + 64, + 224, + 208 + ], + "aqua": [ + 0, + 255, + 255 + ], + "cyan": [ + 0, + 255, + 255 + ], + "aquamarine": [ + 127, + 255, + 212 + ], + "paleturquoise": [ + 175, + 238, + 238 + ], + "lightcyan": [ + 224, + 255, + 255 + ], + "navy": [ + 0, + 0, + 128 + ], + "darkblue": [ + 0, + 0, + 139 + ], + "mediumblue": [ + 0, + 0, + 205 + ], + "blue": [ + 0, + 0, + 255 + ], + "midnightblue": [ + 25, + 25, + 112 + ], + "royalblue": [ + 65, + 105, + 225 + ], + "steelblue": [ + 70, + 130, + 180 + ], + "dodgerblue": [ + 30, + 144, + 255 + ], + "deepskyblue": [ + 0, + 191, + 255 + ], + "cornflowerblue": [ + 100, + 149, + 237 + ], + "skyblue": [ + 135, + 206, + 235 + ], + "lightskyblue": [ + 135, + 206, + 250 + ], + "lightsteelblue": [ + 176, + 196, + 222 + ], + "lightblue": [ + 173, + 216, + 230 + ], + "powderblue": [ + 176, + 224, + 230 + ], + "indigo": [ + 75, + 0, + 130 + ], + "purple": [ + 128, + 0, + 128 + ], + "darkmagenta": [ + 139, + 0, + 139 + ], + "darkviolet": [ + 148, + 0, + 211 + ], + "darkslateblue": [ + 72, + 61, + 139 + ], + "blueviolet": [ + 138, + 43, + 226 + ], + "darkorchid": [ + 153, + 50, + 204 + ], + "fuchsia": [ + 255, + 0, + 255 + ], + "magenta": [ + 255, + 0, + 255 + ], + "slateblue": [ + 106, + 90, + 205 + ], + "mediumslateblue": [ + 123, + 104, + 238 + ], + "mediumorchid": [ + 186, + 85, + 211 + ], + "mediumpurple": [ + 147, + 112, + 219 + ], + "orchid": [ + 218, + 112, + 214 + ], + "violet": [ + 238, + 130, + 238 + ], + "plum": [ + 221, + 160, + 221 + ], + "thistle": [ + 216, + 191, + 216 + ], + "lavender": [ + 230, + 230, + 250 + ], + "mistyrose": [ + 255, + 228, + 225 + ], + "antiquewhite": [ + 250, + 235, + 215 + ], + "linen": [ + 250, + 240, + 230 + ], + "beige": [ + 245, + 245, + 220 + ], + "whitesmoke": [ + 245, + 245, + 245 + ], + "lavenderblush": [ + 255, + 240, + 245 + ], + "oldlace": [ + 253, + 245, + 230 + ], + "aliceblue": [ + 240, + 248, + 255 + ], + "seashell": [ + 255, + 245, + 238 + ], + "ghostwhite": [ + 248, + 248, + 255 + ], + "honeydew": [ + 240, + 255, + 240 + ], + "floralwhite": [ + 255, + 250, + 240 + ], + "azure": [ + 240, + 255, + 255 + ], + "mintcream": [ + 245, + 255, + 250 + ], + "snow": [ + 255, + 250, + 250 + ], + "ivory": [ + 255, + 255, + 240 + ], + "white": [ + 255, + 255, + 255 + ], + "black": [ + 0, + 0, + 0 + ], + "darkslategray": [ + 47, + 79, + 79 + ], + "dimgray": [ + 105, + 105, + 105 + ], + "slategray": [ + 112, + 128, + 144 + ], + "gray": [ + 128, + 128, + 128 + ], + "lightslategray": [ + 119, + 136, + 153 + ], + "darkgray": [ + 169, + 169, + 169 + ], + "silver": [ + 192, + 192, + 192 + ], + "lightgray": [ + 211, + 211, + 211 + ], + "gainsboro": [ + 220, + 220, + 220 + ], + "copper": [ + 184, + 115, + 51 + ], + "bronze": [ + 205, + 127, + 50 + ], + "steel": [ + 206, + 210, + 215 + ], + "platinum": [ + 229, + 228, + 226 + ], + "gunmetal": [ + 92, + 93, + 91 + ], + "titanium": [ + 135, + 134, + 129 + ], + "rosegold": [ + 203, + 163, + 178 + ], + "aquaglass": [ + 210, + 232, + 223 + ], + "blueglass": [ + 199, + 227, + 225 + ] + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/map.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/map.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/icons.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/components/labels.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var LabelSetVisual$2 = class { + render(elapsedTime, xrFrame) {} + update(elapsedTime) {} + constructor(labelSet) { + this.label = labelSet; + } + }; + var LabelBase$1 = class { + get material() { + return this._material; + } + get vertices() { + return this._vertices; + } + get verticesView() { + return this._verticesView; + } + get indices() { + return this._indices; + } + get indexCount() { + return this._indexCount; + } + get isInitialized() { + return this._isInitialized; + } + get mMatrix() { + return this._mMatrix; + } + get materialType() { + return this._materialType; + } + get materialColor() { + return this._materialColor; + } + get materialFuzz() { + return this._materialFuzz; + } + get materialGloss() { + return this._materialGloss; + } + get segmentColor() { + return this._segmentColor; + } + get scale() { + return this._scale; + } + set scale(value) { + if (this._scale != value) { + this._scale = value; + this._hasChanged = true; + } + } + get font() { + return this._font; + } + set font(value) { + if (this._font != value) { + this._font = value; + this._hasChanged = true; + } + } + get rotation() { + return this._rotation; + } + set rotation(value) { + if (this._rotation != value) { + this._rotation = value; + this._hasChanged = true; + } + } + set reverseX(value) { + if (this._reverseX != value) { + this._reverseX = value; + this._hasChanged = true; + } + } + set reverseY(value) { + if (this._reverseY != value) { + this._reverseY = value; + this._hasChanged = true; + } + } + set reverseZ(value) { + if (this._reverseZ != value) { + this._reverseZ = value; + this._hasChanged = true; + } + } + get horizontalAlignment() { + return this._horizontalAlignment; + } + set horizontalAlignment(value) { + if (this._horizontalAlignment != value) { + this._horizontalAlignment = value; + this._hasChanged = true; + } + } + get verticalAlignment() { + return this._verticalAlignment; + } + set verticalAlignment(value) { + if (this._verticalAlignment != value) { + this._verticalAlignment = value; + this._hasChanged = true; + } + } + get offsetX() { + return this._offsetX; + } + set offsetX(value) { + if (this._offsetX != value) { + this._offsetX = value; + this._hasChanged = true; + } + } + get offsetY() { + return this._offsetY; + } + set offsetY(value) { + if (this._offsetY != value) { + this._offsetY = value; + this._hasChanged = true; + } + } + get offsetZ() { + return this._offsetZ; + } + set offsetZ(value) { + if (this._offsetZ != value) { + this._offsetZ = value; + this._hasChanged = true; + } + } + get maxGlyphTop() { + return this._maxGlyphTop; + } + set maxGlyphTop(value) { + if (this._maxGlyphTop != value) { + this._maxGlyphTop = value; + this._hasChanged = true; + } + } + get maxGlyphHeight() { + return this._maxGlyphHeight; + } + set maxGlyphHeight(value) { + if (this._maxGlyphHeight != value) { + this._maxGlyphHeight = value; + this._hasChanged = true; + } + } + constructor(core, options) { + this._core = core; + this._offset = create$6(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mMatrix = create$7(); + this._indexCount = 0; + this._maxGlyphs = options.maxGlyphs; + this._textMetric = { + width: 0, + maxHeight: 0, + maxTop: 0 + }; + this.scale = options.scale ? options.scale : 1; + this.offsetX = options.offsetX ? options.offsetX : 0; + this.offsetY = options.offsetY ? options.offsetY : 0; + this.offsetZ = options.offsetZ ? options.offsetZ : 0; + this.reverseX = options.reverseX; + this.reverseY = options.reverseY; + this.reverseZ = options.reverseZ; + this.rotation = options.rotation; + this.maxGlyphTop = options.maxGlyphTop; + this.horizontalAlignment = options.horizontalAlignment === void 0 ? HorizontalAlignment.center : options.horizontalAlignment; + this.verticalAlignment = options.verticalAlignment === void 0 ? VerticalAlignment.center : options.verticalAlignment; + this._material = options.material; + this.borderWidth = core.config.textBorderWidth; + this.gamma = 0; + this._materialType = options.materialType || 0; + this._materialColor = options.materialColor || core.config.textColor; + this._materialFuzz = options.materialFuzz || 0; + this._materialGloss = options.materialGloss || 0; + this._segmentColor = options.segmentColor; + } + initialize() { + this._vertices = /* @__PURE__ */ new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); + this._verticesView = new DataView(this._vertices); + this._indices = new Uint32Array(this._maxGlyphs * 6); + this._isInitialized = true; + } + update(elapsedTime) {} + }; + var LabelSet = class extends LabelBase$1 { + get materials() { + return this._materials; + } + get materialTypes() { + return this._materialTypes; + } + get materialColors() { + return this._materialColors; + } + get materialFuzzes() { + return this._materialFuzzes; + } + get materialGlosses() { + return this._materialGlosses; + } + get segmentColors() { + return this._segmentColors; + } + get minBoundsX() { + return this._minBoundsX; + } + set minBoundsX(value) { + if (this._minBoundsX != value) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { + return this._minBoundsY; + } + set minBoundsY(value) { + if (this._minBoundsY != value) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get minBoundsZ() { + return this._minBoundsZ; + } + set minBoundsZ(value) { + if (this._minBoundsZ != value) { + this._minBoundsZ = value; + this._hasChanged = true; + } + } + get maxBoundsX() { + return this._maxBoundsX; + } + set maxBoundsX(value) { + if (this._maxBoundsX != value) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsY() { + return this._maxBoundsY; + } + set maxBoundsY(value) { + if (this._maxBoundsY != value) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsZ() { + return this._maxBoundsZ; + } + set maxBoundsZ(value) { + if (this._maxBoundsZ != value) { + this._maxBoundsZ = value; + this._hasChanged = true; + } + } + get positionsX() { + return this._positionsX; + } + set positionsX(value) { + if (this._positionsX != value) { + this._positionsX = value; + this._hasChanged = true; + } + } + get positionsY() { + return this._positionsY; + } + set positionsY(value) { + if (this._positionsY != value) { + this._positionsY = value; + this._hasChanged = true; + } + } + get positionsZ() { + return this._positionsZ; + } + set positionsZ(value) { + if (this._positionsZ != value) { + this._positionsZ = value; + this._hasChanged = true; + } + } + get positionScalingX() { + return this._positionScalingX; + } + set positionScalingX(value) { + if (this._positionScalingX != value) { + this._positionScalingX = value; + this._hasChanged = true; + } + } + get positionScalingY() { + return this._positionScalingY; + } + set positionScalingY(value) { + if (this._positionScalingY != value) { + this._positionScalingY = value; + this._hasChanged = true; + } + } + get positionScalingZ() { + return this._positionScalingZ; + } + set positionScalingZ(value) { + if (this._positionScalingZ != value) { + this._positionScalingZ = value; + this._hasChanged = true; + } + } + get rotations() { + return this._rotations; + } + set rotations(value) { + if (this._rotations != value) { + this._rotations = value; + this._hasChanged = true; + } + } + get offsetsX() { + return this._offsetsX; + } + set offsetsX(value) { + if (this._offsetsX != value) { + this._offsetsX = value; + this._hasChanged = true; + } + } + get offsetsY() { + return this._offsetsY; + } + set offsetsY(value) { + if (this._offsetsY != value) { + this._offsetsY = value; + this._hasChanged = true; + } + } + get offsetsZ() { + return this._offsetsZ; + } + set offsetsZ(value) { + if (this._offsetsZ != value) { + this._offsetsZ = value; + this._hasChanged = true; + } + } + get offsetScalingX() { + return this._offsetScalingX; + } + set offsetScalingX(value) { + if (this._offsetScalingX != value) { + this._offsetScalingX = value; + this._hasChanged = true; + } + } + get offsetScalingY() { + return this._offsetScalingY; + } + set offsetScalingY(value) { + if (this._offsetScalingY != value) { + this._offsetScalingY = value; + this._hasChanged = true; + } + } + get offsetScalingZ() { + return this._offsetScalingZ; + } + set offsetScalingZ(value) { + if (this._offsetScalingZ != value) { + this._offsetScalingZ = value; + this._hasChanged = true; + } + } + get text() { + return this._text; + } + set text(value) { + if (this._text != value) { + this._text = value; + this._hasChanged = true; + } + } + get horizontalAlignments() { + return this._horizontalAlignments; + } + set horizontalAlignments(value) { + if (this._horizontalAlignments != value) { + this._horizontalAlignments = value; + this._hasChanged = true; + } + } + get verticalAlignments() { + return this._verticalAlignments; + } + set verticalAlignments(value) { + if (this._verticalAlignments != value) { + this._verticalAlignments = value; + this._hasChanged = true; + } + } + get scales() { + return this._scales; + } + set scales(value) { + if (this._scales != value) { + this._scales = value; + this._hasChanged = true; + } + } + get scalesScaling() { + return this._scalesScaling; + } + set scalesScaling(value) { + if (this._scalesScaling != value) { + this._scalesScaling = value; + this._hasChanged = true; + } + } + constructor(core, options) { + super(core, options); + this._quat = create$4(); + this._materials = options.materials; + this._materialType = options.materialType; + this._materialColor = options.materialColors ? null : options.materialColor || core.config.textColor; + this._materialColors = options.materialColors; + this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; + this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; + this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; + this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; + this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; + this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; + this._font = options.font || core.font; + this.text = options.text; + this.positionsX = options.positionsX; + this.positionsY = options.positionsY; + this.positionsZ = options.positionsZ; + this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; + this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; + this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; + this.rotations = options.rotations; + this.offsetsX = options.offsetsX; + this.offsetsY = options.offsetsY; + this.offsetsZ = options.offsetsZ; + this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; + this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; + this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; + if (options.horizontalAlignments) this.horizontalAlignments = options.horizontalAlignments; + if (options.verticalAlignments) this.verticalAlignments = options.verticalAlignments; + if (options.scales) this.scales = options.scales; + this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; + } + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.pickIdLookup = {}; + if (!this._text) this._indexCount = 0; + else { + const start = window.performance.now(); + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; + const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; + const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; + if (this._rotation) set$6(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); + let glyphs = 0; + for (let i = 0; i < this._text.length; i++) { + const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; + const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; + const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; + const text = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); + const scale = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const lineHeight = this._font.size * scale; + const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale; + switch (this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment) { + case HorizontalAlignment.left: + this._offset[0] = offsetX; + break; + case HorizontalAlignment.center: + this._offset[0] = offsetX - width / 2; + break; + case HorizontalAlignment.right: + this._offset[0] = offsetX - width; + break; + } + switch (this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment) { + case VerticalAlignment.top: + this._offset[1] = offsetY - lineHeight / 2; + break; + case VerticalAlignment.center: + this._offset[1] = offsetY; + break; + case VerticalAlignment.bottom: + this._offset[1] = offsetY + lineHeight / 2; + break; + } + this._offset[1] -= maxGlyphTop / 2; + this._offset[2] = offsetZ; + let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; + let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; + let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; + if (this._reverseX) positionX = this.minBoundsX + this.maxBoundsX - positionX; + if (this._reverseY) positionY = this.minBoundsY + this.maxBoundsY - positionY; + if (this._reverseZ) positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; + set$8(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); + if (this._rotations) set$6(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.label, this._vec4); + this.pickIdLookup[pickId] = i; + TextHelper.addString(this._font, text, this._verticesView, this._indices, glyphs, this._vec3, scale, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); + glyphs += text.length; + if (glyphs >= this._maxGlyphs) { + glyphs = this._maxGlyphs; + break; + } + } + this._indexCount = glyphs * 6; + this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); + if (this.hasChangedCallback) this.hasChangedCallback(); + } + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/meshes/sphere.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/components/image.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ImageVisual$2 = class { + render(elapsedTime, xrFrame) {} + update(elapsedTime) {} + constructor(image) { + this.image = image; + } + }; + var ImageBase$1 = class { + get material() { + return this._material; + } + get vertices() { + return this._vertices; + } + get indices() { + return this._indices; + } + get indexCount() { + return this._indexCount; + } + get isInitialized() { + return this._isInitialized; + } + get mMatrix() { + return this._mMatrix; + } + get imageData() { + return this._imageData; + } + set imageData(value) { + if (this._imageData != value) { + this._imageData = value; + this._hasChanged = true; + } + } + get rotation() { + return this._rotation; + } + set rotation(value) { + if (!equals$1(this._rotation, value)) { + copy$4(this._rotation, value); + this._hasChanged = true; + } + } + get position() { + return this._position; + } + set position(value) { + if (!equals$2(this._position, value)) { + copy$6(this._position, value); + this._hasChanged = true; + } + } + get texCoord0() { + return this._texCoord0; + } + set texCoord0(value) { + if (!equals(this._texCoord0, value)) { + copy$3(this._texCoord0, value); + this._hasChanged = true; + } + } + get texCoord1() { + return this._texCoord1; + } + set texCoord1(value) { + if (!equals(this._texCoord1, value)) { + copy$3(this._texCoord1, value); + this._hasChanged = true; + } + } + get minBoundsX() { + return this._minBoundsX; + } + set minBoundsX(value) { + if (this._minBoundsX != value) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { + return this._minBoundsY; + } + set minBoundsY(value) { + if (this._minBoundsY != value) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get minBoundsZ() { + return this._minBoundsZ; + } + set minBoundsZ(value) { + if (this._minBoundsZ != value) { + this._minBoundsZ = value; + this._hasChanged = true; + } + } + get maxBoundsX() { + return this._maxBoundsX; + } + set maxBoundsX(value) { + if (this._maxBoundsX != value) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsY() { + return this._maxBoundsY; + } + set maxBoundsY(value) { + if (this._maxBoundsY != value) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsZ() { + return this._maxBoundsZ; + } + set maxBoundsZ(value) { + if (this._maxBoundsZ != value) { + this._maxBoundsZ = value; + this._hasChanged = true; + } + } + constructor(core, options) { + this._core = core; + this._mMatrix = create$7(); + this._origin = create$6(); + this._translation = create$6(); + this._scale = create$6(); + this._transform = create$7(); + this._imageData = options.imageData; + this._minBoundsX = options.minBoundsX === void 0 ? 0 : options.minBoundsX; + this._minBoundsY = options.minBoundsY === void 0 ? 0 : options.minBoundsY; + this._minBoundsZ = options.minBoundsZ === void 0 ? 0 : options.minBoundsZ; + this._maxBoundsX = options.maxBoundsX === void 0 ? 1 : options.maxBoundsX; + this._maxBoundsY = options.maxBoundsY === void 0 ? 1 : options.maxBoundsY; + this._maxBoundsZ = options.maxBoundsZ === void 0 ? 1 : options.maxBoundsZ; + this._position = options.position ? clone$4(options.position) : create$6(); + this._rotation = options.rotation ? clone$2(options.rotation) : create$4(); + this._texCoord0 = options.texCoord0 ? clone$1(options.texCoord0) : fromValues(0, 0); + this._texCoord1 = options.texCoord1 ? clone$1(options.texCoord1) : fromValues(1, 1); + this._material = options.material === void 0 ? -1 : options.material; + this._hasChanged = true; + } + }; + var ImageQuad = class extends ImageBase$1 { + get width() { + return this._width; + } + set width(value) { + if (this._width != value) { + this._width = value; + this._hasChanged = true; + } + } + get height() { + return this._height; + } + set height(value) { + if (this._height != value) { + this._height = value; + this._hasChanged = true; + } + } + constructor(core, options) { + super(core, options); + this._width = options.width === void 0 ? 1 : options.width; + this._height = options.height === void 0 ? 1 : options.height; + this._texTransform = create$7(); + translate$2(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); + scale$6(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); + } + initialize() { + this._vertices = /* @__PURE__ */ new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); + this._indices = Quad$2.INDICES; + this._indexCount = this._indices.length; + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + set$8(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); + subtract(this._translation, this._position, this._origin); + scale$5(this._translation, this._translation, boundsScaling); + set$8(this._scale, this._width, this._height, 1); + scale$5(this._scale, this._scale, boundsScaling); + fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); + this._verticesView = Quad$2.normalTextured(this._transform, this._texTransform); + this._vertices = this._verticesView.buffer; + if (this.hasChangedCallback) this.hasChangedCallback(); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/bounds.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var BoundsHelper = class { + static rotateBounds(minBounds, maxBounds, rotation, rotatedMinBounds, rotatedMaxBounds, offset) { + const sizeX = maxBounds[0] - minBounds[0]; + const sizeY = maxBounds[1] - minBounds[1]; + const sizeZ = maxBounds[2] - minBounds[2]; + const min = rotatedMinBounds; + const max = rotatedMaxBounds; + set$8(min, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$8(max, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const vertices = Cube.POSITIONS; + const position = create$6(); + for (let i = 0; i < 8; i++) { + set$8(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); + add$4(position, position, offset); + transformQuat(position, position, rotation); + subtract(position, position, offset); + min$3(min, min, position); + max$3(max, max, position); + } + add$4(position, minBounds, maxBounds); + scale$5(position, position, .5); + add$4(min, min, position); + add$4(max, max, position); + } + static cylinder(pa, pb, radius, minBounds, maxBounds) { + const a = create$6(); + subtract(a, pb, pa); + const aa = dot$1(a, a); + const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); + const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); + const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); + minBounds[0] = Math.min(pa[0] - ex, pb[0] - ex); + minBounds[1] = Math.min(pa[1] - ey, pb[1] - ey); + minBounds[2] = Math.min(pa[2] - ez, pb[2] - ez); + maxBounds[0] = Math.max(pa[0] + ex, pb[0] + ex); + maxBounds[1] = Math.max(pa[1] + ey, pb[1] + ey); + maxBounds[2] = Math.max(pa[2] + ez, pb[2] + ez); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/layout.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var LayoutBase = class { + get facetScaling() { + return this._facetScaling; + } + offsetX(facetCoordX) { + return ((facetCoordX + .5) / this._facetsX - .5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; + } + offsetY(facetCoordY) { + return ((facetCoordY + .5) / this._facetsY - .5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; + } + offsetZ(facetCoordZ) { + return ((facetCoordZ + .5) / this._facetsZ - .5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; + } + constructor(core) { + this._core = core; + this.modelOriginX = 0; + this.modelOriginY = 0; + this.modelOriginZ = 0; + this.minModelBoundsX = 0; + this.minModelBoundsY = 0; + this.minModelBoundsZ = 0; + this.maxModelBoundsX = 0; + this.maxModelBoundsY = 0; + this.maxModelBoundsZ = 0; + this.minLayoutBoundsX = 0; + this.minLayoutBoundsY = 0; + this.minLayoutBoundsZ = 0; + this.maxLayoutBoundsX = 0; + this.maxLayoutBoundsY = 0; + this.maxLayoutBoundsZ = 0; + this._facetSpacingX = 0; + this._facetSpacingY = 0; + this._facetSpacingZ = 0; + this._facetSizeX = 0; + this._facetSizeY = 0; + this._facetSizeZ = 0; + this._facetsX = 1; + this._facetsY = 1; + this._facetsZ = 1; + } + _updateModelBounds(options) { + this.minModelBoundsX = options.minBoundsX === void 0 ? this.minLayoutBoundsX : options.minBoundsX; + this.minModelBoundsY = options.minBoundsY === void 0 ? this.minLayoutBoundsY : options.minBoundsY; + this.minModelBoundsZ = options.minBoundsZ === void 0 ? this.minLayoutBoundsZ : options.minBoundsZ; + this.maxModelBoundsX = options.maxBoundsX === void 0 ? this.maxLayoutBoundsX : options.maxBoundsX; + this.maxModelBoundsY = options.maxBoundsY === void 0 ? this.maxLayoutBoundsY : options.maxBoundsY; + this.maxModelBoundsZ = options.maxBoundsZ === void 0 ? this.maxLayoutBoundsZ : options.maxBoundsZ; + this._isFacetted = options.facetsX !== void 0 && options.facetsX > 1 && options.facetCoordsX != null || options.facetsY !== void 0 && options.facetsY > 1 && options.facetCoordsY != null || options.facetsZ !== void 0 && options.facetsZ > 1 && options.facetCoordsZ != null; + this._facetSpacingX = options.facetSpacingX === void 0 ? 0 : options.facetSpacingX; + this._facetSpacingY = options.facetSpacingY === void 0 ? 0 : options.facetSpacingY; + this._facetSpacingZ = options.facetSpacingZ === void 0 ? 0 : options.facetSpacingZ; + let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._facetSizeX = modelSizeX; + this._facetSizeY = modelSizeY; + this._facetSizeZ = modelSizeZ; + this._facetsX = options.facetCoordsX ? options.facetsX : 1; + this._facetsY = options.facetCoordsY ? options.facetsY : 1; + this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; + this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; + this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; + this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; + this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); + this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); + this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); + this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; + this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; + this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; + modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; + this._facetScaling = maxBounds / this._maxBounds; + } + resetCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = void 0; + this.minCumulativeLayoutBoundsY = void 0; + this.minCumulativeLayoutBoundsZ = void 0; + this.maxCumulativeLayoutBoundsX = void 0; + this.maxCumulativeLayoutBoundsY = void 0; + this.maxCumulativeLayoutBoundsZ = void 0; + } + _updateCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === void 0 ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); + this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === void 0 ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); + this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === void 0 ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); + this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === void 0 ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); + this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === void 0 ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); + this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === void 0 ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); + } + unitToModelSize(unitSize) { + return unitSize / this._boundsScaling; + } + unitToModelPositionX(unitPositionX) { + return this.unitToModelSize(unitPositionX) + this.modelOriginX; + } + unitToModelPositionY(unitPositionY) { + return this.unitToModelSize(unitPositionY) + this.modelOriginY; + } + unitToModelPositionZ(unitPositionZ) { + return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; + } + unitToModelPosition(unitPosition, modelPosition) { + modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); + modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); + modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); + } + modelToUnitSize(modelSize) { + return modelSize * this._boundsScaling; + } + modelToUnitPositionX(modelPositionX) { + return (modelPositionX - this.modelOriginX) * this._boundsScaling; + } + modelToUnitPositionY(modelPositionY) { + return (modelPositionY - this.modelOriginY) * this._boundsScaling; + } + modelToUnitPositionZ(modelPositionZ) { + return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + } + modelToUnitPosition(modelPosition, unitPosition) { + unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); + unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); + unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); + } + inclusiveUnitBounds(buffer, ids, unitType, offset, count, minBounds, maxBounds) { + set$8(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$8(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const unitScale = create$6(); + const unitRotation = create$4(); + const unitTranslation = create$6(); + const lookup = buffer.lookup; + const dataView = buffer.dataView; + let minBounds0; + let maxBounds0; + let minBounds1; + let maxBounds1; + switch (unitType) { + case UnitType.sphere: + case UnitType.sphereSdf: + for (let i = 0; i < count; i++) { + const index = lookup[ids[i + offset]]; + UnitVertex.getTranslation(dataView, index, unitTranslation); + UnitVertex.getScale(dataView, index, unitScale); + const radius = unitScale[0] / 2; + minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius); + minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius); + minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius); + maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius); + maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius); + maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius); + } + break; + case UnitType.hexPrism: + case UnitType.hexPrismSdf: + case UnitType.block: + case UnitType.blockSdf: + minBounds0 = create$6(); + maxBounds0 = create$6(); + minBounds1 = create$6(); + maxBounds1 = create$6(); + for (let i = 0; i < count; i++) { + const index = lookup[ids[i + offset]]; + UnitVertex.getTranslation(dataView, index, unitTranslation); + UnitVertex.getRotation(dataView, index, unitRotation); + UnitVertex.getScale(dataView, index, unitScale); + minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; + minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; + minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; + maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; + maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; + maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; + BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants$2.VECTOR3_ZERO); + min$3(minBounds, minBounds, minBounds1); + max$3(maxBounds, maxBounds, maxBounds1); + } + break; + case UnitType.cylinder: + case UnitType.cylinderSdf: + minBounds0 = create$6(); + maxBounds0 = create$6(); + const pa = create$6(); + const pb = create$6(); + const identityRotation = Constants$2.VECTOR3_UNITY; + let ca; + for (let i = 0; i < count; i++) { + const index = lookup[ids[i + offset]]; + UnitVertex.getTranslation(dataView, index, unitTranslation); + UnitVertex.getRotation(dataView, index, unitRotation); + UnitVertex.getScale(dataView, index, unitScale); + const length = unitScale[1]; + const radius = Math.max(unitScale[0], unitScale[2]); + if (length != 0 && radius != 0) { + if (equals$1(unitRotation, Constants$2.QUAT_IDENTITY)) ca = identityRotation; + else { + ca = create$6(); + transformQuat(ca, identityRotation, unitRotation); + } + scaleAndAdd(pa, unitTranslation, ca, -length * .5); + scaleAndAdd(pb, unitTranslation, ca, length * .5); + BoundsHelper.cylinder(pa, pb, radius, minBounds0, maxBounds0); + min$3(minBounds, minBounds, minBounds0); + max$3(maxBounds, maxBounds, maxBounds0); + } + } + break; + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/scatter.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Scatter = class extends LayoutBase { + layout(buffer, ids, options) { + const start = window.performance.now(); + const offset = options.offset === void 0 ? 0 : options.offset; + const count = options.count === void 0 ? ids.length : options.count; + const positionScalingX = options.positionScalingX === void 0 ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === void 0 ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === void 0 ? 1 : options.positionScalingZ; + if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const lookup = buffer.lookup; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = lookup[id]; + let positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; + let positionY = options.positionsY ? options.positionsY[id] * positionScalingY : 0; + let positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; + this._positions[index * 3] = positionX; + this._positions[index * 3 + 1] = positionY; + this._positions[index * 3 + 2] = positionZ; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, options) { + const start = window.performance.now(); + const offset = options.offset === void 0 ? 0 : options.offset; + const count = options.count === void 0 ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create$3(); + const _vec3 = create$6(); + const _vec4 = create$5(); + const _quat = create$4(); + const sizeScalingX = options.sizeScaling === void 0 ? options.sizeScalingX === void 0 ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === void 0 ? options.sizeScalingY === void 0 ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === void 0 ? options.sizeScalingZ === void 0 ? 1 : options.sizeScalingZ : options.sizeScaling; + const sizesX = options.sizes ? options.sizes : options.sizesX; + const sizesY = options.sizes ? options.sizes : options.sizesY; + const sizesZ = options.sizes ? options.sizes : options.sizesZ; + const minSize = options.minSize === void 0 ? 0 : options.minSize; + const minColor = options.minColor === void 0 ? 0 : options.minColor; + const maxColor = options.maxColor === void 0 ? 1 : options.maxColor; + const minOrder = options.minOrder === void 0 ? 0 : options.minOrder; + const maxOrder = options.maxOrder === void 0 ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === void 0 ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === void 0 ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === void 0 ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === void 0 ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === void 0 ? false : options.reverseX; + const reverseY = options.reverseY === void 0 ? false : options.reverseY; + const reverseZ = options.reverseZ === void 0 ? false : options.reverseZ; + this._updateModelBounds(options); + if (options.rotation) { + _quat[0] = options.rotation[0]; + _quat[1] = options.rotation[1]; + _quat[2] = options.rotation[2]; + _quat[3] = options.rotation[3]; + } else rotationTo(_quat, this._core.config.identityRotation, Constants$2.VECTOR3_UNITY); + if (options.texCoord) { + _vec4[0] = options.texCoord[0]; + _vec4[1] = options.texCoord[1]; + _vec4[2] = options.texCoord[2]; + _vec4[3] = options.texCoord[3]; + } + const lookup = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = lookup[id]; + let positionX = this._positions[index * 3]; + let positionY = this._positions[index * 3 + 1]; + let positionZ = this._positions[index * 3 + 2]; + if (this._isFacetted) { + if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index, _vec3); + _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id]) : 1) * sizeScalingX, minSize) * this._boundsScaling; + _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id]) : 1) * sizeScalingY, minSize) * this._boundsScaling; + _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; + UnitVertex.setScale(dataView, index, _vec3); + if (options.rotations) { + _quat[0] = options.rotations[id * 4]; + _quat[1] = options.rotations[id * 4 + 1]; + _quat[2] = options.rotations[id * 4 + 2]; + _quat[3] = options.rotations[id * 4 + 3]; + UnitVertex.setRotation(dataView, index, _quat); + } else UnitVertex.setRotation(dataView, index, _quat); + if (options.colors) { + const size = 1 / (maxColor - minColor + 1); + const color = MathHelper.normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); + if (options.colors1) set$5(_vec2, color, MathHelper.normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2)); + else set$5(_vec2, color, color); + UnitVertex.setColor(dataView, index, _vec2); + } else UnitVertex.setColor(dataView, index, Constants$2.VECTOR2_ONE); + UnitVertex.setIdHover(dataView, index, options.hover ? options.hover[id] : id); + UnitVertex.setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); + if (options.order !== void 0) { + const order = MathHelper.normalize(options.order[id], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else _vec2[0] = count == 1 ? 0 : i / (count - 1); + if (options.staggerOrder !== void 0) _vec2[1] = options.staggerOrder; + else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else _vec2[1] = count == 1 ? 0 : i / (count - 1); + UnitVertex.setOrder(dataView, index, _vec2); + UnitVertex.setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); + UnitVertex.setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); + UnitVertex.setParameter1(dataView, index, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id] : 0); + UnitVertex.setParameter2(dataView, index, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id] : 0); + UnitVertex.setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + if (options.texCoords) { + _vec4[0] = options.texCoords[id * 4]; + _vec4[1] = options.texCoords[id * 4 + 1]; + _vec4[2] = options.texCoords[id * 4 + 2]; + _vec4[3] = options.texCoords[id * 4 + 3]; + UnitVertex.setTexCoord(dataView, index, _vec4); + } else UnitVertex.setTexCoord(dataView, index, _vec4); + UnitVertex.setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + UnitVertex.setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [ + options.materialColors[id * 3], + options.materialColors[id * 3 + 1], + options.materialColors[id * 3 + 2] + ] : [ + 0, + 0, + 0 + ]); + UnitVertex.setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + UnitVertex.setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + UnitVertex.setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + UnitVertex.setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [ + options.segmentColors[id * 4], + options.segmentColors[id * 4 + 1], + options.segmentColors[id * 4 + 2], + options.segmentColors[id * 4 + 3] + ] : [ + buffer.idColors[id * 4], + buffer.idColors[id * 4 + 1], + buffer.idColors[id * 4 + 2], + buffer.idColors[id * 4 + 3] + ]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/components/keys.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/components/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/components/axes/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/color.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ColorHelper = class ColorHelper { + static luminance(rgb) { + return rgb[0] * ColorHelper.LUMINANCE[0] + rgb[1] * ColorHelper.LUMINANCE[1] + rgb[2] * ColorHelper.LUMINANCE[2]; + } + static rgbToHex(r, g, b) { + const r2 = `0${Math.round(r * 255).toString(16)}`; + const g2 = `0${Math.round(g * 255).toString(16)}`; + const b2 = `0${Math.round(b * 255).toString(16)}`; + return `#${r2.substring(r2.length - 2)}${g2.substring(g2.length - 2)}${b2.substring(b2.length - 2)}`; + } + static rgbToHsv(r, g, b, hsv) { + let h, s, v, delta; + const min = Math.min(Math.min(r, g), b); + const max = Math.max(Math.max(r, g), b); + delta = max - min; + v = max; + if (delta == 0) { + h = -1; + if (max == 0) s = -1; + else s = 0; + hsv[0] = h; + hsv[1] = s; + hsv[2] = v; + } + s = delta / max; + if (r == max) h = (g - b) / delta; + else if (g == max) h = 2 + (b - r) / delta; + else h = 4 + (r - g) / delta; + h *= 60; + if (h < 0) h += 360; + hsv[0] = h; + hsv[1] = s; + hsv[2] = v; + } + static hsvToRgb(h, s, v, rgb) { + let sextant, r, g, b; + if (s == 0) { + r = g = b = v; + rgb[0] = r; + rgb[1] = g; + rgb[2] = b; + } + let frac, p, q, t; + h %= 360; + h /= 60; + sextant = Math.floor(h); + frac = h - sextant; + p = v * (1 - s); + q = v * (1 - s * frac); + t = v * (1 - s * (1 - frac)); + switch (sextant) { + case 0: + r = v; + g = t; + b = p; + break; + case 1: + r = q; + g = v; + b = p; + break; + case 2: + r = p; + g = v; + b = t; + break; + case 3: + r = p; + g = q; + b = v; + break; + case 4: + r = t; + g = p; + b = v; + break; + default: + r = v; + g = p; + b = q; + break; + } + rgb[0] = r; + rgb[1] = g; + rgb[2] = b; + } + }; + ColorHelper.LUMINANCE = fromValues$3(.2126, .7152, .0722); + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/csv.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/facet.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/hex.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var HexHelper = class { + static width(size, orientation) { + if (orientation == HexOrientation.pointyTop) return Constants$2.ROOT_THREE * size; + else return 2 * size; + } + static height(size, orientation) { + if (orientation == HexOrientation.pointyTop) return 2 * size; + else return Constants$2.ROOT_THREE * size; + } + static pointyHexCorner(center, size, i, position) { + const angle = AngleHelper.degreesToRadians(60 * i - 30); + position[0] = center[0] + size * Math.cos(angle); + position[1] = center[1] + size * Math.sin(angle); + } + static cubeToAxial(cube, hex) { + hex[0] = cube[0]; + hex[1] = cube[2]; + } + static axialToCube(hex, cube) { + const x = hex[0]; + const z = hex[1]; + const y = -x - z; + cube[0] = x; + cube[1] = y; + cube[2] = z; + } + static cubeToOddr(cube, hex) { + const col = cube[0] + (cube[2] - (cube[2] & 1)) / 2; + const row = cube[2]; + hex[0] = col; + hex[1] = row; + } + static oddrToCube(hex, cube) { + const x = hex[0] - (hex[1] - (hex[1] & 1)) / 2; + const z = hex[1]; + const y = -x - z; + cube[0] = x; + cube[1] = y; + cube[2] = z; + } + static pointyHexToPixel(hex, size, point) { + point[0] = size * (Constants$2.ROOT_THREE * hex[0] + Constants$2.ROOT_THREE / 2 * hex[1]); + point[1] = size * (3 / 2 * hex[1]); + } + static pixelToPointyHex(point, size, hex) { + hex[0] = (Constants$2.ROOT_THREE / 3 * point[0] - 1 / 3 * point[1]) / size; + hex[1] = 2 / 3 * point[1] / size; + this.hexRound(hex, hex); + } + static hexRound(hex, hexRound) { + const cube = this._vec3; + this.axialToCube(hex, cube); + this.cubeRound(cube, cube); + this.cubeToAxial(cube, hexRound); + } + static cubeRound(cube, cubeRound) { + let rx = Math.round(cube[0]); + let ry = Math.round(cube[1]); + let rz = Math.round(cube[2]); + const x_diff = Math.abs(rx - cube[0]); + const y_diff = Math.abs(ry - cube[1]); + const z_diff = Math.abs(rz - cube[2]); + if (x_diff > y_diff && x_diff > z_diff) rx = -ry - rz; + else if (y_diff > z_diff) ry = -rx - rz; + else rz = -rx - ry; + cubeRound[0] = rx; + cubeRound[1] = ry; + cubeRound[2] = rz; + } + }; + HexHelper._vec3 = create$6(); + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/hexbin.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/line.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/palette.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var PaletteHelper = class PaletteHelper { + static resample(colorsIn, divisionsOut, reverse) { + const divisionsIn = colorsIn.length / 3; + const colorsOut = new Uint8Array(divisionsOut * 4); + for (let i = 0; i < divisionsOut; i++) { + const positionIn = (i + .5) / divisionsOut * (divisionsIn - 1); + const stepIn = Math.floor(positionIn); + const fractIn = positionIn - stepIn; + const j = reverse ? divisionsOut - i - 1 : i; + colorsOut[j * 4] = MathHelper.lerp(colorsIn[stepIn * 3], colorsIn[(stepIn + 1) * 3], fractIn); + colorsOut[j * 4 + 1] = MathHelper.lerp(colorsIn[stepIn * 3 + 1], colorsIn[(stepIn + 1) * 3 + 1], fractIn); + colorsOut[j * 4 + 2] = MathHelper.lerp(colorsIn[stepIn * 3 + 2], colorsIn[(stepIn + 1) * 3 + 2], fractIn); + colorsOut[j * 4 + 3] = 255; + } + return colorsOut; + } + static truncate(colorsIn, divisionsOut, reverse) { + const divisionsIn = colorsIn.length / 3; + const colorsOut = new Uint8Array(divisionsOut * 4); + for (let i = 0; i < Math.min(divisionsIn, divisionsOut); i++) { + const j = reverse ? divisionsOut - i - 1 : i; + colorsOut[j * 4] = colorsIn[i * 3]; + colorsOut[j * 4 + 1] = colorsIn[i * 3 + 1]; + colorsOut[j * 4 + 2] = colorsIn[i * 3 + 2]; + colorsOut[j * 4 + 3] = 255; + } + return colorsOut; + } + static resampleStops(stops, divisions, reverse) { + const colorsOut = new Uint8Array(divisions * 4); + let from = 0; + let to = 0; + for (let i = 0; i < divisions; i++) { + const positionOut = (i + .5) / divisions; + while (stops[from].position < positionOut && from < stops.length - 1) from++; + from = Math.max(from - 1, 0); + to = Math.min(from + 1, stops.length - 1); + const fromStop = stops[from]; + const toStop = stops[to]; + const fract = from == to ? 0 : (positionOut - fromStop.position) / (toStop.position - fromStop.position); + const j = reverse ? divisions - i - 1 : i; + colorsOut[j * 4] = MathHelper.lerp(fromStop.r, toStop.r, fract); + colorsOut[j * 4 + 1] = MathHelper.lerp(fromStop.g, toStop.g, fract); + colorsOut[j * 4 + 2] = MathHelper.lerp(fromStop.b, toStop.b, fract); + colorsOut[j * 4 + 3] = 255; + } + return colorsOut; + } + static lerpRgb(from, to, divisions) { + const colors = new Uint8Array(divisions * 4); + for (let i = 0; i < divisions; i++) { + const amount = i / (divisions - 1); + colors[i * 4] = MathHelper.lerp(from[0], to[0], amount); + colors[i * 4 + 1] = MathHelper.lerp(from[1], to[1], amount); + colors[i * 4 + 2] = MathHelper.lerp(from[2], to[2], amount); + colors[i * 4 + 3] = 255; + } + return colors; + } + static lerpHsv(from, to, divisions) { + const colors = new Uint8Array(divisions * 4); + for (let i = 0; i < divisions; i++) { + const amount = i / (divisions - 1); + const h = MathHelper.lerp(from[0], to[0], amount); + const s = MathHelper.lerp(from[1], to[1], amount); + const v = MathHelper.lerp(from[2], to[2], amount); + ColorHelper.hsvToRgb(h, s, v, PaletteHelper._rgb); + colors[i * 4] = PaletteHelper._rgb[0] * 255; + colors[i * 4 + 1] = PaletteHelper._rgb[1] * 255; + colors[i * 4 + 2] = PaletteHelper._rgb[2] * 255; + colors[i * 4 + 3] = 255; + } + return colors; + } + }; + PaletteHelper._rgb = create$6(); + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/path.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var PathHelper = class { + static getFilenameWithoutExtension(path) { + const dot = path.lastIndexOf("."); + if (dot == -1) return path; + else { + const start = path.lastIndexOf("/") == -1 ? 0 : path.lastIndexOf("/") + 1; + return path.substring(start, dot); + } + } + static getExtension(path) { + const dot = path.lastIndexOf("."); + if (dot == -1 || dot == path.length - 1) return null; + else return path.substring(dot + 1, path.length); + } + static getFilename(path) { + if (path.lastIndexOf("/") == -1) return path; + else { + const start = path.lastIndexOf("/") + 1; + return path.substring(start, path.length); + } + } + static getPath(path) { + if (path.lastIndexOf("/") == -1) return ""; + else return path.substring(0, path.lastIndexOf("/")); + } + static combine(first, second) { + const seperator = first.lastIndexOf("/") == first.length - 1; + if (second.indexOf("/") == 0) if (seperator) return first.substring(0, first.length - 1) + second; + else return first + second; + else if (seperator) return first + second; + else return first + "/" + second; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/tables/filter.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/tables/table.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/table.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/texture.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var TextureHelper = class { + static create(gl, width, height, format, type, filter, bytes, internalFormat = format) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, bytes); + return texture; + } + static fromImage(gl, image, mipmaps, filter) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); + if (mipmaps && MathHelper.isPowerOf2(image.width) && MathHelper.isPowerOf2(image.height)) gl.generateMipmap(gl.TEXTURE_2D); + else { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + } + gl.bindTexture(gl.TEXTURE_2D, null); + return texture; + } + static cubemapFromImages(gl, images) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + const targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (let i = 0; i < 6; i++) { + gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + return texture; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/vector.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/helpers/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/bar.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/cube.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/line.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Line = class extends LayoutBase { + layout(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset = options.offset === void 0 ? 0 : options.offset; + const count = options.count === void 0 ? ids.length : options.count; + const positionScalingX = options.positionScalingX === void 0 ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === void 0 ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === void 0 ? 1 : options.positionScalingZ; + const sizeScalingX = options.sizeScaling === void 0 ? options.sizeScalingX === void 0 ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === void 0 ? options.sizeScalingY === void 0 ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === void 0 ? options.sizeScalingZ === void 0 ? 1 : options.sizeScalingZ : options.sizeScaling; + const minSize = options.minSize === void 0 ? 0 : options.minSize; + const offsetScaling = options.offsetScaling === void 0 ? 1 : options.offsetScaling; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + this._sizes = new Float32Array(buffer.length * 3); + this._rotations = new Float32Array(buffer.length * 4); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const _vec3 = create$6(); + const _quat = create$4(); + const direction = create$6(); + const lookup = buffer.lookup; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const fromId = fromIds[id]; + const toId = toIds[id]; + const index = lookup[id]; + let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; + let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; + let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; + let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; + let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; + let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; + if (fromId == toId) { + this._sizes[index * 3] = 0; + this._sizes[index * 3 + 1] = 0; + this._sizes[index * 3 + 2] = 0; + this._rotations[index * 4] = 0; + this._rotations[index * 4 + 1] = 0; + this._rotations[index * 4 + 2] = 0; + this._rotations[index * 4 + 3] = 1; + } else { + direction[0] = toPositionX - fromPositionX; + direction[1] = toPositionY - fromPositionY; + direction[2] = toPositionZ - fromPositionZ; + let length = length$1(direction); + scale$5(direction, direction, 1 / length); + rotationTo(_quat, this._core.config.identityRotation, direction); + this._rotations[index * 4] = _quat[0]; + this._rotations[index * 4 + 1] = _quat[1]; + this._rotations[index * 4 + 2] = _quat[2]; + this._rotations[index * 4 + 3] = _quat[3]; + if (options.offsets) { + const fromOffset = options.offsets[fromId] * offsetScaling / 2; + const toOffset = options.offsets[toId] * offsetScaling / 2; + toPositionX -= direction[0] * toOffset; + toPositionY -= direction[1] * toOffset; + toPositionZ -= direction[2] * toOffset; + fromPositionX += direction[0] * fromOffset; + fromPositionY += direction[1] * fromOffset; + fromPositionZ += direction[2] * fromOffset; + length = Math.max(length - toOffset - fromOffset, minSize); + } + this._sizes[index * 3 + 1] = Math.max(length * sizeScalingY, minSize); + if (options.lineSizes) { + this._sizes[index * 3] = Math.max(options.lineSizes[id] * sizeScalingX, minSize); + this._sizes[index * 3 + 2] = Math.max(options.lineSizes[id] * sizeScalingZ, minSize); + } else if (options.endSizes) { + this._sizes[index * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); + this._sizes[index * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); + } else { + this._sizes[index * 3] = sizeScalingX; + this._sizes[index * 3 + 2] = sizeScalingZ; + } + } + _vec3[0] = (fromPositionX + toPositionX) / 2; + _vec3[1] = (fromPositionY + toPositionY) / 2; + _vec3[2] = (fromPositionZ + toPositionZ) / 2; + this._positions[index * 3] = _vec3[0]; + this._positions[index * 3 + 1] = _vec3[1]; + this._positions[index * 3 + 2] = _vec3[2]; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset = options.offset === void 0 ? 0 : options.offset; + const count = options.count === void 0 ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create$3(); + const _vec3 = create$6(); + const _quat = create$4(); + const endMinColor = options.endMinColor === void 0 ? 0 : options.endMinColor; + const endMaxColor = options.endMaxColor === void 0 ? 1 : options.endMaxColor; + const lineMinColor = options.lineMinColor === void 0 ? 0 : options.lineMinColor; + const lineMaxColor = options.lineMaxColor === void 0 ? 1 : options.lineMaxColor; + const minOrder = options.minOrder === void 0 ? 0 : options.minOrder; + const maxOrder = options.maxOrder === void 0 ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === void 0 ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === void 0 ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === void 0 ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === void 0 ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === void 0 ? false : options.reverseX; + const reverseY = options.reverseY === void 0 ? false : options.reverseY; + const reverseZ = options.reverseZ === void 0 ? false : options.reverseZ; + this._updateModelBounds(options); + const lookup = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const fromId = fromIds[id]; + const toId = toIds[id]; + const index = lookup[id]; + let positionX = this._positions[index * 3]; + let positionY = this._positions[index * 3 + 1]; + let positionZ = this._positions[index * 3 + 2]; + if (this._isFacetted) { + if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index, _vec3); + _vec3[0] = this._sizes[index * 3] * this._boundsScaling; + _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; + _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; + UnitVertex.setScale(dataView, index, _vec3); + _quat[0] = this._rotations[index * 4]; + _quat[1] = this._rotations[index * 4 + 1]; + _quat[2] = this._rotations[index * 4 + 2]; + _quat[3] = this._rotations[index * 4 + 3]; + if (reverseX) { + _quat[1] = -_quat[1]; + _quat[2] = -_quat[2]; + } + if (reverseY) { + _quat[0] = -_quat[0]; + _quat[2] = -_quat[2]; + } + if (reverseZ) { + _quat[0] = -_quat[0]; + _quat[1] = -_quat[1]; + } + UnitVertex.setRotation(dataView, index, _quat); + let size; + if (options.endColors) { + size = 1 / (endMaxColor - endMinColor + 1); + set$5(_vec2, MathHelper.normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2), MathHelper.normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2)); + UnitVertex.setColor(dataView, index, _vec2); + } else if (options.lineColors) { + size = 1 / (lineMaxColor - lineMinColor + 1); + const color = MathHelper.normalize(options.lineColors[id], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); + set$5(_vec2, color, color); + UnitVertex.setColor(dataView, index, _vec2); + } else UnitVertex.setColor(dataView, index, Constants$2.VECTOR2_ONE); + UnitVertex.setIdHover(dataView, index, options.hover ? options.hover[id] : id); + UnitVertex.setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); + if (options.order !== void 0) { + const order = MathHelper.normalize(options.order[id], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else _vec2[0] = count == 1 ? 0 : i / (count - 1); + if (options.staggerOrder !== void 0) _vec2[1] = options.staggerOrder; + else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else _vec2[1] = count == 1 ? 0 : i / (count - 1); + UnitVertex.setOrder(dataView, index, _vec2); + UnitVertex.setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); + UnitVertex.setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); + UnitVertex.setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + UnitVertex.setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + UnitVertex.setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [ + options.materialColors[id * 3], + options.materialColors[id * 3 + 1], + options.materialColors[id * 3 + 2] + ] : [ + 0, + 0, + 0 + ]); + UnitVertex.setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + UnitVertex.setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + UnitVertex.setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + UnitVertex.setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [ + options.segmentColors[id * 4], + options.segmentColors[id * 4 + 1], + options.segmentColors[id * 4 + 2], + options.segmentColors[id * 4 + 3] + ] : [ + buffer.idColors[id * 4], + buffer.idColors[id * 4 + 1], + buffer.idColors[id * 4 + 2], + buffer.idColors[id * 4 + 3] + ]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/tree.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/sheet.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/treemap.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/stack.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/layouts/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/input/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/meshes/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/atlas.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AtlasBase = class { + get imageData() { + return this._imageData; + } + set imageData(value) { + if (this._imageData != value) { + this._imageData = value; + this._changed = true; + } + } + constructor() { + this._imageData = null; + } + copyFrom(atlas) { + if (atlas.imageData) { + this._imageData = atlas.imageData; + this._changed = true; + } else this.imageData = null; + } + update() {} + }; + var Atlas$2 = class extends AtlasBase {}; + //#endregion + //#region ../../node_modules/morphcharts/dist/buffer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var BufferBase = class { + get isInitialized() { + return this._isInitialized; + } + get ids() { + return this._ids; + } + get dataView() { + return this._dataView; + } + get vertices() { + return this._vertices; + } + get lookup() { + return this._lookup; + } + get length() { + return this._length; + } + get selected() { + return this._selected; + } + constructor(core, ids) { + this._core = core; + this._ids = ids; + this._length = ids.length; + this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); + this._dataView = new DataView(this._vertices); + this._selected = /* @__PURE__ */ new Set(); + this.from = 0; + this.to = 1; + this.unitType = UnitType.block; + this._lookup = {}; + for (let i = 0; i < this._length; i++) { + const id = ids[i]; + this._lookup[id] = i; + UnitVertex.setRotation(this._dataView, i, Constants$2.QUAT_IDENTITY); + } + } + createShared() { + const buffer = Object.create(this); + buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); + buffer._dataView = new DataView(buffer._vertices); + return buffer; + } + copyFrom(buffer) { + const start = window.performance.now(); + const fromDataView = buffer.dataView; + const toDataView = this._dataView; + const lookup = buffer.lookup; + for (let i = 0; i < this._length; i++) { + const index = lookup[this._ids[i]]; + if (index != null) { + UnitVertex.copyIdHover(fromDataView, index, toDataView, i); + UnitVertex.copyTranslation(fromDataView, index, toDataView, i); + UnitVertex.copyScale(fromDataView, index, toDataView, i); + UnitVertex.copyRotation(fromDataView, index, toDataView, i); + UnitVertex.copyColor(fromDataView, index, toDataView, i); + UnitVertex.copySelected(fromDataView, index, toDataView, i); + UnitVertex.copyMaterial(fromDataView, index, toDataView, i); + UnitVertex.copyRounding(fromDataView, index, toDataView, i); + UnitVertex.copyOrder(fromDataView, index, toDataView, i); + UnitVertex.copyTexCoord(fromDataView, index, toDataView, i); + UnitVertex.copyTexture(fromDataView, index, toDataView, i); + UnitVertex.copySdfBuffer(fromDataView, index, toDataView, i); + UnitVertex.copySdfBorder(fromDataView, index, toDataView, i); + UnitVertex.copyParameter1(fromDataView, index, toDataView, i); + UnitVertex.copyParameter2(fromDataView, index, toDataView, i); + UnitVertex.copyMatId(fromDataView, index, toDataView, i); + UnitVertex.copyMatColor(fromDataView, index, toDataView, i); + UnitVertex.copyMatFuzz(fromDataView, index, toDataView, i); + UnitVertex.copyMatRefractiveIndex(fromDataView, index, toDataView, i); + UnitVertex.copyMatGloss(fromDataView, index, toDataView, i); + UnitVertex.copyMatDensity(fromDataView, index, toDataView, i); + UnitVertex.copySegColor(fromDataView, index, toDataView, i); + } else UnitVertex.setRotation(toDataView, i, Constants$2.QUAT_IDENTITY); + } + this.unitType = buffer.unitType; + this._selected = buffer.selected; + this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + update() {} + updateSelection(options) { + const start = window.performance.now(); + const ids = options && options.ids ? options.ids : this._ids; + const offset = options && options.offset !== void 0 ? options.offset : 0; + const count = options && options.count !== void 0 ? options.count : ids.length; + const selection = this._selected.size > 0; + const dataView = this._dataView; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = this._lookup[id]; + UnitVertex.setSelected(dataView, index, selection ? this._selected.has(id) ? 1 : -1 : 0); + } + this.update(); + this._core.log.write(LogLevel.info, `buffer update selection ${count} ${Math.round(window.performance.now() - start)}ms`); + } + }; + var TransitionBufferBase = class TransitionBufferBase { + get pickIdLookup() { + return this._pickIdLookup; + } + get currentBuffer() { + return this._isBuffer1Current ? this._buffer1 : this._buffer2; + } + get previousBuffer() { + return this._isBuffer1Current ? this._buffer2 : this._buffer1; + } + get currentPalette() { + return this._isBuffer1Current ? this._palette1 : this._palette2; + } + get previousPalette() { + return this._isBuffer1Current ? this._palette2 : this._palette1; + } + get currentAtlas() { + return this._isBuffer1Current ? this._atlas1 : this._atlas2; + } + get previousAtlas() { + return this._isBuffer1Current ? this._atlas2 : this._atlas1; + } + get isInitialized() { + return this._isInitialized; + } + get length() { + return this._length; + } + constructor(core, ids, bufferType, paletteType, atlasType) { + this.bufferType = bufferType; + this.paletteType = paletteType; + this.atlasType = atlasType; + this._core = core; + this._length = ids.length; + this.id = TransitionBufferBase._id++; + this.isVisible = true; + this.transitionTime = 1; + this.activeId = -1; + const start = window.performance.now(); + this._buffer1 = new bufferType(core, ids); + this._buffer2 = this._buffer1.createShared(); + this._palette1 = new paletteType(); + this._palette2 = new paletteType(); + this._atlas1 = new atlasType(); + this._atlas2 = new atlasType(); + this.isPickingEnabled = true; + this._pickIdLookup = {}; + const dataView1 = this._buffer1.dataView; + const dataView2 = this._buffer2.dataView; + const _vec4 = create$5(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; + for (let i = 0; i < this._length; i++) { + const id = ids[i]; + const pickId = PickHelper.nextPickId(); + this._pickIdLookup[pickId] = id; + PickHelper.encodeNumber(pickId, PickType.data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; + UnitVertex.setIdColor(dataView1, i, _vec4); + UnitVertex.setIdColor(dataView2, i, _vec4); + } + this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + swap() { + this._isBuffer1Current = !this._isBuffer1Current; + } + copyFrom(transitionBuffer) { + const start = window.performance.now(); + this.key = transitionBuffer.key; + this.isVisible = transitionBuffer.isVisible; + this.transitionTime = transitionBuffer.transitionTime; + this.isPickingEnabled = transitionBuffer.isPickingEnabled; + this.unitType = transitionBuffer.unitType; + this.activeId = transitionBuffer.activeId; + this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); + this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); + this.currentBuffer.update(); + this.previousBuffer.update(); + this.currentPalette.copyFrom(transitionBuffer.currentPalette); + this.previousPalette.copyFrom(transitionBuffer.previousPalette); + this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); + this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); + this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + }; + TransitionBufferBase._id = 1; + var Buffer$3 = class extends BufferBase { + constructor(core, ids) { + super(core, ids); + } + }; + var TransitionBuffer$2 = class extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$3, Palette$3, Atlas$2); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/components/debug.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var DebugAxes = class { + get vertices() { + return this._vertices; + } + get indices() { + return this._indices; + } + get indexCount() { + return this._indexCount; + } + get isInitialized() { + return this._isInitialized; + } + initialize() { + let vertexOffset = 0; + let indexOffset = 0; + const axisVertices = Cube.POSITIONS; + const axisIndices = Cube.INDICES; + this._vertices = /* @__PURE__ */ new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); + const verticesView = new DataView(this._vertices); + this._indices = new Uint16Array(3 * axisIndices.length + 4); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices.length; + const transform = create$7(); + const length = 1; + const width = .01; + transform[0] = length; + transform[5] = width; + transform[10] = width; + transform[12] = .5; + transform[13] = 0; + transform[14] = 0; + this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants$2.VECTOR3_UNITX, transform, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices[0] + vertexOffset; + transform[0] = width; + transform[5] = length; + transform[10] = width; + transform[12] = 0; + transform[13] = .5; + transform[14] = 0; + this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants$2.VECTOR3_UNITY, transform, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices[0] + vertexOffset; + transform[0] = width; + transform[5] = width; + transform[10] = length; + transform[12] = 0; + transform[13] = 0; + transform[14] = .5; + this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants$2.VECTOR3_UNITZ, transform, vertexOffset, indexOffset); + this._indexCount = this._indices.length; + this._isInitialized = true; + } + update(elapsedTime) {} + _createAxis(axisVertices, axisIndices, verticesView, indices, color, transform, vertexOffset, indexOffset) { + const position = create$6(); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices.length; + for (let i = 0; i < vertexCount; i++) { + set$8(position, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); + transformMat4$2(position, position, transform); + PositionColorVertex.setPosition(verticesView, vertexOffset + i, position); + PositionColorVertex.setColor(verticesView, vertexOffset + i, color); + } + for (let i = 0; i < indexCount; i++) indices[indexOffset + i] = axisIndices[i] + vertexOffset; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/renderer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter$5 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + 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) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var RendererConfig = class { + reset() {} + }; + var RendererBase = class { + get isInitialized() { + return this._isInitialized; + } + get config() { + return this._config; + } + get devicePixelRatio() { + return this._devicePixelRatio; + } + get width() { + return this._canvas.width; + } + set width(value) { + this._options.width = value; + } + get height() { + return this._canvas.height; + } + set height(value) { + this._options.height = value; + } + get webXRReferenceSpace() { + return this._webXRReferenceSpace; + } + get pickedType() { + return this._pickedType; + } + get pickedId() { + return this._pickedId; + } + get isCapturingPickImage() { + return this._isCapturingPickImage; + } + capturePickImage() { + this._isCapturingPickImage = true; + } + get backgroundColor() { + return this._backgroundColor; + } + set backgroundColor(value) { + if (!exactEquals(value, this._backgroundColor)) this._backgroundColor = value; + } + get ambientColor() { + return this._ambientColor; + } + set ambientColor(value) { + if (!exactEquals$1(value, this._ambientColor)) this._ambientColor = value; + } + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; + } + set currentAxes(value) { + if (this._isAxes1Current) this._axes1 = value; + else this._axes2 = value; + } + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; + } + set previousAxes(value) { + if (this._isAxes1Current) this._axes2 = value; + else this._axes1 = value; + } + swapAxes() { + this._isAxes1Current = !this._isAxes1Current; + } + createCartesian2dAxesVisual(axes) { + return new AxesVisual(axes); + } + createCartesian3dAxesVisual(axes) { + return new AxesVisual(axes); + } + _createDebugAxesVisual(debugAxes) { + return null; + } + createLabelSetVisual(labelSet) { + return new LabelSetVisual$2(labelSet); + } + createControllerVisual(controller) { + return new ControllerVisual$1(controller); + } + createTransitionBuffer(ids) { + return new TransitionBuffer$2(this._core, ids); + } + createImageVisual(image) { + return new ImageVisual$2(image); + } + createFontVisual(font) { + return new FontVisual$2(font); + } + constructor(options) { + this._options = options; + this.fonts = {}; + } + get isWebXRSupported() { + return false; + } + initialize(core) { + this._core = core; + this._canvas = document.createElement("canvas"); + if (!(this._options && this._options.contextmenu)) this._canvas.addEventListener("contextmenu", (e) => { + e.preventDefault(); + }); + this._canvas.tabIndex = this._core.container.tabIndex; + this._canvas.style.display = "block"; + this._canvas.style.touchAction = "none"; + this._core.container.appendChild(this._canvas); + this._mvMatrices = [create$7(), create$7()]; + this.pickPMatrix = create$7(); + this.axesVisibility = AxesVisibility.current; + this._debugAxes = new DebugAxes(); + this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); + this.transitionTime = 1; + this.transitionBuffers = []; + this.areLabelsVisible = true; + this.labelSets = []; + this.controllers = []; + this.areImagesVisible = true; + this.images = []; + this._viewports = [new DOMRect(), new DOMRect()]; + this.isPickingEnabled = false; + this._pickedType = PickType.none; + this._pickedId = 0; + this._lassoMMatrix = create$7(); + this._lassoThickness = create$3(); + this._resizeMinimumDelay = -1; + this._previousResizeWidth = -1; + this._previousResizeHeight = -1; + } + remove() { + this._core.container.removeChild(this._canvas); + } + finalize() { + this._isInitialized = false; + } + setSize(elapsedTime) { + if (this._options && this._options.width && this._options.height) { + this._devicePixelRatio = 1; + this._resizeWidth = this._options.width; + this._resizeHeight = this._options.height; + } else { + this._devicePixelRatio = window.devicePixelRatio || 1; + this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; + this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; + } + if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { + this._previousResizeWidth = this._resizeWidth; + this._previousResizeHeight = this._resizeHeight; + this._isResizing = true; + this._resizeElapsedTime = elapsedTime; + } + if (this._isResizing) if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { + this._isResizing = false; + this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; + this._resize(this._resizeWidth, this._resizeHeight); + } else this._resizeElapsedTime += elapsedTime; + } + _resize(width, height) { + this._canvas.style.width = `${Math.floor(width / this._devicePixelRatio)}px`; + this._canvas.style.height = `${Math.floor(height / this._devicePixelRatio)}px`; + width = Math.floor(width); + height = Math.floor(height); + this._canvas.width = width; + this._canvas.height = height; + } + update(elapsedTime) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousPalette; + const current = transitionBuffer.currentPalette; + if (previous) previous.update(); + if (current) current.update(); + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousAtlas; + const current = transitionBuffer.currentAtlas; + if (previous) previous.update(); + if (current) current.update(); + } + } + if (this._core.config.isDebugVisible) { + if (this._debugAxesVisual) { + this._debugAxesVisual.mMatrix = this.mMatrix; + this._debugAxesVisual.vMatrices = this.vMatrices; + this._debugAxesVisual.pMatrices = this.pMatrices; + this._debugAxesVisual.viewports = this._viewports; + this._debugAxesVisual.viewportOffset = this._viewportOffset; + this._debugAxesVisual.viewportCount = this._viewportCount; + } + } + if (this.areLabelsVisible) for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + this.labelSets[i].label.update(elapsedTime); + labelSetVisual.mMatrix = this.mMatrix; + labelSetVisual.vMatrices = this.vMatrices; + labelSetVisual.pMatrices = this.pMatrices; + labelSetVisual.isPickingEnabled = this.isPickingEnabled; + labelSetVisual.pickPMatrix = this.pickPMatrix; + labelSetVisual.pickVMatrix = this.pickVMatrix; + labelSetVisual.viewports = this._viewports; + labelSetVisual.viewportOffset = this._viewportOffset; + labelSetVisual.viewportCount = this._viewportCount; + labelSetVisual.update(elapsedTime); + } + } + if (this.areImagesVisible) for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual && imageVisual.isVisible) { + this.images[i].image.update(elapsedTime); + imageVisual.mMatrix = this.mMatrix; + imageVisual.vMatrices = this.vMatrices; + imageVisual.pMatrices = this.pMatrices; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.pickPMatrix = this.pickPMatrix; + imageVisual.pickVMatrix = this.pickVMatrix; + imageVisual.viewports = this._viewports; + imageVisual.viewportOffset = this._viewportOffset; + imageVisual.viewportCount = this._viewportCount; + imageVisual.update(elapsedTime); + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + this.controllers[i].controller.update(elapsedTime); + controllerVisual.vMatrices = this.vMatrices; + controllerVisual.inverseVMatrices = this.vMatrices; + controllerVisual.pMatrices = this.pMatrices; + controllerVisual.viewports = this._viewports; + controllerVisual.viewportOffset = this._viewportOffset; + controllerVisual.viewportCount = this._viewportCount; + controllerVisual.update(elapsedTime); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + const axes = axesVisual.axes; + axes.mMatrix = this.mMatrix; + axes.vMatrix = this.vMatrices[0]; + axes.update(elapsedTime); + axesVisual.vMatrices = this.vMatrices; + axesVisual.pMatrices = this.pMatrices; + axesVisual.isPickingEnabled = this.isPickingEnabled; + axesVisual.pickPMatrix = this.pickPMatrix; + axesVisual.pickVMatrix = this.pickVMatrix; + axesVisual.viewports = this._viewports; + axesVisual.viewportOffset = this._viewportOffset; + axesVisual.viewportCount = this._viewportCount; + axesVisual.update(elapsedTime); + } + } + for (const key in this.fonts) { + const fontVisual = this.fonts[key]; + fontVisual.font.update(); + fontVisual.update(); + } + } + getVertexPosition(position, pickedId) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + const id = transitionBuffer.pickIdLookup[pickedId]; + if (id > -1) { + const index = transitionBuffer.currentBuffer.lookup[id]; + const dataView = transitionBuffer.currentBuffer.dataView; + UnitVertex.getTranslation(dataView, index, position); + break; + } + } + } + render(elapsedTime, xrFrame) { + return __awaiter$5(this, void 0, void 0, function* () {}); + } + prepare(xrFrame) {} + initializeWebXR(session) { + return null; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/quad.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Quad$1 = class { + get isInitialized() { + return this._isInitialized; + } + get vertexBuffer() { + return this._vertexBuffer; + } + get indexBuffer() { + return this._indexBuffer; + } + get indexCount() { + return this._indexCount; + } + initializeContext(gl) { + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$7(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/atlas.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Atlas$1 = class extends AtlasBase { + get texture() { + return this._texture; + } + get defaultTexture() { + return this._defaultTexture; + } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ + 255, + 255, + 255, + 255 + ])); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._imageData) this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + else this._texture = null; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/palette.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Palette$2 = class extends PaletteBase { + get texture() { + return this._texture; + } + get defaultTexture() { + return this._defaultTexture; + } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._colors) { + const colors = new Uint8Array(this._colors); + for (let i = 0; i < colors.length; i++) colors[i] = Math.pow(colors[i] / 255, 2.2) * 255; + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); + } else this._texture = null; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/buffer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Buffer$2 = class extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update() { + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + } + }; + var TransitionBuffer$1 = class extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$2, Palette$2, Atlas$1); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/config.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Config$1 = class extends RendererConfig { + constructor() { + super(); + this.reset(); + } + reset() { + this.specularIntensity = .15; + this.specularPower = 150; + this.lightPosition = fromValues$3(-.5, .5, 0); + this.ambient = .01; + const _quat1 = create$4(); + const _quat2 = create$4(); + let angle = AngleHelper.degreesToRadians(15); + setAxisAngle(_quat1, Constants$2.VECTOR3_UNITX, angle); + multiply(_quat2, _quat1, _quat2); + angle = AngleHelper.degreesToRadians(-15); + setAxisAngle(_quat1, Constants$2.VECTOR3_UNITY, angle); + multiply(_quat2, _quat2, _quat1); + this.directionToLight = create$6(); + transformQuat(this.directionToLight, Constants$2.VECTOR3_UNITZ, _quat2); + this.halfAngle = create$6(); + add$4(this.halfAngle, Constants$2.VECTOR3_UNITZ, this.directionToLight); + normalize$5(this.halfAngle, this.halfAngle); + this.isFxaaEnabled = false; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/shader.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Resources$1 = class { + bindFramebuffer(framebuffer) { + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } + } + initializeContext(gl) { + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); + this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); + this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); + this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + }; + Resources$1.glsl = { + "anaglyph.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "color.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n", + "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", + "lasso.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", + "model.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", + "pickgrid.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n", + "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", + "sdftext.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n", + "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", + "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", + "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", + "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", + "unitblock.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n", + "unitblock.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unitcylinder.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", + "unitcylinder.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unithexprism.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.ytN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", + "unithexprism.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n", + "unitsdf.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n", + "unitsdf.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", + "unitsphere.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", + "unitsphere.vertex.fx": "#version 100\n#include \"common.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", + "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" + }; + var ShaderBase$1 = class { + get isInitialized() { + return this._isInitialized; + } + get vertexBuffer() { + return this._vertexBuffer; + } + set vertexBuffer(value) { + if (this._vertexBuffer != value) { + this._vertexBuffer = value; + this._haveBuffersChanged = true; + } + } + get indexBuffer() { + return this._indexBuffer; + } + set indexBuffer(value) { + if (this._indexBuffer != value) { + this._indexBuffer = value; + this._haveBuffersChanged = true; + } + } + constructor(core, main) { + this._core = core; + this._main = main; + } + initializeContext(gl) { + this._gl = gl; + } + _createProgram(vs, fs) { + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + return program; + } + _compileShader(source, type) { + const shader = this._gl.createShader(type); + this._gl.shaderSource(shader, source); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + return shader; + } + _removeDirective(shaderSource, directive) { + const remove = `#define ${directive}`; + const index = shaderSource.indexOf(remove); + shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); + return shaderSource; + } + prepare() { + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) this.updateBuffers(); + if (this._haveTexturesChanged) this.updateTextures(); + } + } + apply() {} + applyModel() {} + applyView() {} + enableProgram(program) { + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; + } + updateBuffers() { + this._haveBuffersChanged = false; + } + updateTextures() { + this._haveTexturesChanged = false; + } + disableProgram() { + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; + } + _shaderFromFile(vsName, fsName, callback) { + callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); + } + _shaderFromUrl(vsName, fsName, callback) { + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); + }); + }); + }); + }); + } + _sourceFromUrl(url, callback) { + const request = new XMLHttpRequest(); + request.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request.onreadystatechange = () => { + if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); + }; + request.send(); + } + _includesFromFile(source) { + let index = 0; + do { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + const inc = Resources$1.glsl[name]; + source = source.substring(0, index) + inc + source.substring(end + 1); + } + } while (index != -1); + return source; + } + _includesFromUrl(source, index, callback) { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source = source.substring(0, index) + include + source.substring(end + 1); + this._includesFromUrl(source, index, callback); + }); + } else callback(source); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/color.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Color$1 = class extends ShaderBase$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._colorAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/texture.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Texture$1 = class extends ShaderBase$1 { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/lasso.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Lasso$3 = class extends ShaderBase$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; + } + apply() { + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + } + applyView() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/model.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Model = class extends ShaderBase$1 { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + } + applyView() { + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/sdftext.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var SdfText$1 = class extends ShaderBase$1 { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyModel() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/pickgrid.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var PickGrid$1 = class extends ShaderBase$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + ApplyFace() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/unitshader.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitShader$1 = class extends ShaderBase$1 { + get paletteTexture() { + return this._paletteTexture; + } + set paletteTexture(value) { + if (this._paletteTexture != value) { + this._paletteTexture = value; + this._haveTexturesChanged = true; + } + } + get previousPaletteTexture() { + return this._previousPaletteTexture; + } + set previousPaletteTexture(value) { + if (this._previousPaletteTexture != value) { + this._previousPaletteTexture = value; + this._haveTexturesChanged = true; + } + } + get sdfTexture() { + return this._sdfTexture; + } + set sdfTexture(value) { + if (this._sdfTexture != value) { + this._sdfTexture = value; + this._haveTexturesChanged = true; + } + } + get previousSdfTexture() { + return this._previousSdfTexture; + } + set previousSdfTexture(value) { + if (this._previousSdfTexture != value) { + this._previousSdfTexture = value; + this._haveTexturesChanged = true; + } + } + set instanceBuffer(value) { + if (this._instanceBuffer != value) { + this._instanceBuffer = value; + this._haveBuffersChanged = true; + } + } + set previousInstanceBuffer(value) { + if (this._previousInstanceBuffer != value) { + this._previousInstanceBuffer = value; + this._haveBuffersChanged = true; + } + } + initializeData() { + this._areBuffersInitialized = false; + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); + this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); + this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); + this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); + } + _updateCurrentBuffer() { + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); + } + _updatePreviousBuffer() { + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform1f(this._ambientUniform, this.ambient); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._activeColorUniform, this.activeColor); + this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0 : 1); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + } + updateTextures() { + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/unitblock.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitBlock$1 = class extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/unitsphere.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitSphere$1 = class extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/unitcylinder.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitCylinder$1 = class extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/unithexprism.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitHexPrism = class extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/unitsdf.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitSdf$1 = class extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + apply() { + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); + this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/shaders/anaglyph.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Anaglyph = class extends ShaderBase$1 { + get texture2D1() { + return this._texture2D1; + } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { + return this._texture2D2; + } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/debug.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var DebugAxesVisual = class { + get isInitialized() { + return this._isInitialized && this._main.colorShader.isInitialized; + } + constructor(core, main, debugAxes) { + this._main = main; + this._debugAxes = debugAxes; + this.isVisible = true; + } + initializeContext(gl) { + if (!this._debugAxes.isInitialized) this._debugAxes.initialize(); + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) {} + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const colorShader = this._main.colorShader; + const shaderResources = this._main.shaderResources; + colorShader.vertexBuffer = this._vertexBuffer; + colorShader.indexBuffer = this._indexBuffer; + colorShader.prepare(); + colorShader.mMatrix = this.mMatrix; + colorShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + colorShader.vMatrix = this.vMatrices[viewport]; + colorShader.pMatrix = this.pMatrices[viewport]; + colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/axes/axes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AxesVisualBase$1 = class { + get isInitialized() { + return this._isInitialized; + } + get axes() { + return this._axes; + } + constructor(core) { + this._core = core; + this.isVisible = true; + } + initializeContext(gl) { + this._gl = gl; + } + update(elapsedTime) {} + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() {} + _renderText() {} + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/axes/cartesian2d.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cartesian2dVisual$1 = class extends AxesVisualBase$1 { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) axes.initialize(); + if (axes.gridVertices) this._createGridBuffers(); + if (axes.textVertices) this._createTextBuffers(); + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants$2.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/axes/cartesian3d.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cartesian3dVisual$1 = class extends AxesVisualBase$1 { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) axes.initialize(); + if (axes.gridVertices) this._createGridBuffers(); + if (axes.textVertices) this._createTextBuffers(); + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants$2.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/controller.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ControllerVisual = class { + get isInitialized() { + return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; + } + get controller() { + return this._controller; + } + constructor(core, main, controller) { + this._core = core; + this._main = main; + this._mMatrix = create$7(); + this._vec3 = create$6(); + this._controller = controller; + this._modelShader = main.modelShader; + this._colorShader = main.colorShader; + this.mMatrix = create$7(); + this.rayMMatrix = create$7(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._controller.isInitialized) this._controller.initialize(); + this._initialize(gl); + } + _initialize(gl) { + this._gl = gl; + this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); + this._modelVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); + this._modelIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); + this._rayVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); + this._rayIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) {} + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._modelShader.vertexBuffer = this._modelVertexBuffer; + this._modelShader.indexBuffer = this._modelIndexBuffer; + this._modelShader.texture2D = this.modelTexture; + this._modelShader.prepare(); + multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); + this._modelShader.mMatrix = this._mMatrix; + this._modelShader.specularPower = 10; + this._modelShader.specularIntensity = .01; + this._modelShader.apply(); + this._modelShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._modelShader.directionToLight = Constants$2.VECTOR3_UNITZ; + this._modelShader.halfAngle = Constants$2.VECTOR3_UNITZ; + this._modelShader.vMatrix = this.vMatrices[viewport]; + this._modelShader.pMatrix = this.pMatrices[viewport]; + this._modelShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isRayVisible) { + this._colorShader.vertexBuffer = this._rayVertexBuffer; + this._colorShader.indexBuffer = this._rayIndexBuffer; + this._colorShader.prepare(); + multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); + this._colorShader.mMatrix = this._mMatrix; + this._colorShader.apply(); + this._colorShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._colorShader.vMatrix = this.vMatrices[viewport]; + this._colorShader.pMatrix = this.pMatrices[viewport]; + this._colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/image.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ImageVisual$1 = class { + get isInitialized() { + return this._isInitialized && this._main.textureShader.isInitialized; + } + get image() { + return this._image; + } + constructor(core, main, image) { + this._core = core; + this._main = main; + this._image = image; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$7(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._image.isInitialized) this._image.initialize(); + this._gl = gl; + if (this._image.imageData) this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + const shaderResources = this._main.shaderResources; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.isPickShader = false; + textureShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + textureShader.isPickShader = true; + textureShader.vMatrix = this.pickVMatrix; + textureShader.pMatrix = this.pickPMatrix; + textureShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/labels.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var LabelVisualBase$1 = class { + get isInitialized() { + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; + } + constructor(core, main, label) { + this._core = core; + this._main = main; + this._label = label; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$7(); + this.mMatrix = create$7(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._label.isInitialized) this._label.initialize(); + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + } + } + } + }; + var LabelVisual$1 = class extends LabelVisualBase$1 { + get label() { + return this._label; + } + set text(value) { + this._label.text = value; + } + get text() { + return this._label.text; + } + constructor(core, main, label) { + super(core, main, label); + } + }; + var LabelSetVisual$1 = class extends LabelVisualBase$1 { + get label() { + return this._label; + } + constructor(core, main, label) { + super(core, main, label); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/font.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var FontVisual$1 = class { + get isInitialized() { + return this._isInitialized; + } + get font() { + return this._font; + } + constructor(core, font) { + this._core = core; + this._font = font; + font.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) this._hasChanged = true; + } + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/components/lasso.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Lasso$2 = class { + get isInitialized() { + return this._isInitialized; + } + get vertexBuffer() { + return this._vertexBuffer; + } + get indexBuffer() { + return this._indexBuffer; + } + get indexCount() { + return this._indexCount; + } + initializeContext(gl) { + const vertices = Quad$2.textured(Constants$2.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/main.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter$4 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + 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) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var Main$1 = class extends RendererBase { + get shaderResources() { + return this._shaderResources; + } + get colorShader() { + return this._colorShader; + } + get textureShader() { + return this._textureShader; + } + get lassoShader() { + return this._lassoShader; + } + get modelShader() { + return this._modelShader; + } + get sdfTextShader() { + return this._sdfTextShader; + } + get gridShader() { + return this._gridShader; + } + get blockShader() { + return this._blockShader; + } + get sphereShader() { + return this._sphereShader; + } + get cyclinderShader() { + return this._cylinderShader; + } + get hexPrismShader() { + return this._hexPrismShader; + } + get sdfShader() { + return this._sdfShader; + } + get anaglyphShader() { + return this._anaglyphShader; + } + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; + } + set currentAxes(value) { + if (this._isAxes1Current) this._axes1 = value; + else this._axes2 = value; + } + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; + } + set previousAxes(value) { + if (this._isAxes1Current) this._axes2 = value; + else this._axes1 = value; + } + get config() { + return this._config; + } + constructor(options) { + super(options); + this._config = new Config$1(); + this._quad = new Quad$1(); + this._lasso = new Lasso$2(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$5(); + this._mat3 = create$8(); + this._directionToCamera = create$6(); + this._directionToLight = create$6(); + this._halfAngle = create$6(); + this._cameraPosition = create$6(); + this._modelPosition = create$6(); + this.depthEnabled = true; + } + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; + } + get isWebXRSupported() { + return true; + } + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources$1(); + this._colorShader = new Color$1(this._core, this); + this._textureShader = new Texture$1(this._core, this); + this._lassoShader = new Lasso$3(this._core, this); + this._modelShader = new Model(this._core, this); + this._sdfTextShader = new SdfText$1(this._core, this); + this._gridShader = new PickGrid$1(this._core, this); + this._anaglyphShader = new Anaglyph(this._core, this); + this._blockShader = new UnitBlock$1(this._core, this); + this._sphereShader = new UnitSphere$1(this._core, this); + this._cylinderShader = new UnitCylinder$1(this._core, this); + this._hexPrismShader = new UnitHexPrism(this._core, this); + this._sdfShader = new UnitSdf$1(this._core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + this._isInitialized = false; + event.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; + } + _initializeContext(gl) { + this._gl = gl; + for (const key in this.fonts) this.fonts[key].initializeContext(gl); + this._shaderResources.initializeContext(this._gl); + this._colorShader.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._modelShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._anaglyphShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._hexPrismShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._debugAxesVisual.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + this._anaglyphTextures = [null, null]; + this.anaglyphFramebuffers = [null, null]; + for (let i = 0; i < this.transitionBuffers.length; i++) this.transitionBuffers[i].initializeContext(this._gl); + if (this._axes1) for (let i = 0; i < this._axes1.length; i++) this._axes1[i].initializeContext(this._gl); + if (this._axes2) for (let i = 0; i < this._axes2.length; i++) this._axes2[i].initializeContext(this._gl); + for (let i = 0; i < this.labelSets.length; i++) this.labelSets[i].initializeContext(this._gl); + for (let i = 0; i < this.images.length; i++) this.images[i].initializeContext(this._gl); + for (let i = 0; i < this.controllers.length; i++) this.controllers[i].initializeContext(this._gl); + } + _resize(width, height) { + super._resize(width, height); + for (let i = 0; i < 2; i++) { + const texture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width, height); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._anaglyphTextures[i] = texture; + this.anaglyphFramebuffers[i] = framebuffer; + } + this._core.log.write(LogLevel.info, `buffers resized ${width},${height}`); + } + _createContext(canvas) { + const antialias = this._options ? this._options.antialias === void 0 ? true : this._options.antialias : true; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + return canvas.getContext("webgl", { + stencil: true, + alpha: true, + antialias, + preserveDrawingBuffer + }); + } + initializeWebXR(session) { + return new Promise((resolve, reject) => { + this._gl.makeXRCompatible().then(() => { + session.updateRenderState({ + baseLayer: new XRWebGLLayer(session, this._gl), + depthNear: this._core.config.nearPlane, + depthFar: this._core.config.farPlane + }); + session.requestReferenceSpace("local").then((refSpace) => { + this._webXRReferenceSpace = refSpace; + resolve(); + }); + }); + }); + } + prepare(xrFrame) { + if (xrFrame) { + const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); + if (pose) { + const glLayer = xrFrame.session.renderState.baseLayer; + for (let i = 0; i < pose.views.length; i++) { + const view = pose.views[i]; + this.vMatrices[i] = view.transform.inverse.matrix; + this.inverseVMatrices[i] = view.transform.matrix; + multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); + this.mvMatrices[i] = this._mvMatrices[i]; + this.pMatrices[i] = view.projectionMatrix; + const viewport = glLayer.getViewport(view); + this._viewports[i].x = viewport.x; + this._viewports[i].y = viewport.y; + this._viewports[i].width = viewport.width; + this._viewports[i].height = viewport.height; + this._framebuffers[i] = glLayer.framebuffer; + } + } + this._viewportOffset = 0; + this._viewportCount = 2; + } else { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + this._framebuffers[1] = null; + break; + case StereoMode.anaglyph: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = this.anaglyphFramebuffers[0]; + this._framebuffers[1] = this.anaglyphFramebuffers[1]; + break; + case StereoMode.split: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = this._canvas.width / 2; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = null; + this._framebuffers[1] = null; + break; + } + } + } + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer$1(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createControllerVisual(controller) { + const visual = new ControllerVisual(this._core, this, controller); + visual.initializeContext(this._gl); + return visual; + } + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + _createDebugAxesVisual(debugAxes) { + return new DebugAxesVisual(this._core, this, debugAxes); + } + _createLabelVisual(label) { + return new LabelVisual$1(this._core, this, label); + } + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual$1(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; + } + createImageVisual(image) { + const visual = new ImageVisual$1(this._core, this, image); + visual.initializeContext(this._gl); + return visual; + } + createFontVisual(font) { + const visual = new FontVisual$1(this._core, font); + visual.initializeContext(this._gl); + return visual; + } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); + } + render(elapsedTime, xrFrame) { + return __awaiter$4(this, void 0, void 0, function* () { + if (this.depthEnabled) this._gl.enable(this._gl.DEPTH_TEST); + else this._gl.disable(this._gl.DEPTH_TEST); + this._gl.enable(this._gl.CULL_FACE); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); + if (xrFrame) { + const glLayer = xrFrame.session.renderState.baseLayer; + this._shaderResources.bindFramebuffer(glLayer.framebuffer); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else if (this._core.config.stereoMode == StereoMode.anaglyph) { + for (let i = 0; i < 2; i++) { + this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else { + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + if (this._core.config.isDebugVisible) { + this._debugAxesVisual.framebuffers = this._framebuffers; + this._debugAxesVisual.render(elapsedTime, xrFrame); + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.framebuffers = this._framebuffers; + axesVisual.render(elapsedTime, xrFrame); + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) this._renderTransitionBuffer(xrFrame, transitionBuffer); + } + if (this.areLabelsVisible) for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.framebuffers = this._framebuffers; + labelSetVisual.render(elapsedTime, xrFrame); + } + } + if (this.areImagesVisible) for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.framebuffers = this._framebuffers; + imageVisual.pickFramebuffer = this._pickFrameBuffer; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.render(elapsedTime, xrFrame); + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + controllerVisual.isRayVisible = this.isPickingEnabled; + controllerVisual.framebuffers = this._framebuffers; + controllerVisual.render(elapsedTime, xrFrame); + } + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + if (this._isCapturingPickImage && this.capturePickImageCallback) { + this._isCapturingPickImage = false; + const data = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); + this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data); + for (let i = 0; i < data.length / 4; i++) if (data[i * 4 + 3] == PickType.data) data[i * 4 + 3] = 255; + else { + data[i * 4] = 0; + data[i * 4 + 1] = 0; + data[i * 4 + 2] = 0; + data[i * 4 + 3] = 0; + } + const length = this._core.config.pickWidth * this._core.config.pickHeight * 4; + const row = this._core.config.pickWidth * 4; + const end = (this._core.config.pickHeight - 1) * row; + const flipped = new Uint8ClampedArray(length); + for (let i = 0; i < length; i += row) flipped.set(data.subarray(i, i + row), end - i); + this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); + } + } else { + set$7(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { + this._shaderResources.bindFramebuffer(null); + this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); + this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; + this._anaglyphShader.indexBuffer = this._quad.indexBuffer; + this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; + this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; + this._anaglyphShader.prepare(); + this._anaglyphShader.viewport = this._viewports[0]; + this._anaglyphShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + }); + } + _renderTransitionBuffer(xrFrame, transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = 0; + this._blockShader.rangeMax = transitionBuffer.length - 1; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.selectedColor = this._core.config.selectionColor; + this._blockShader.hoverColor = this._core.config.hoverColor; + this._blockShader.activeColor = this._core.config.activeColor; + this._blockShader.highlightMode = this._core.config.highlightMode; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.ambient = this._config.ambient; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._blockShader.directionToLight = this._directionToLight; + this._blockShader.halfAngle = this._halfAngle; + } else { + this._blockShader.directionToLight = this._config.directionToLight; + this._blockShader.halfAngle = this._config.halfAngle; + } + this._blockShader.vMatrix = vMatrix; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = 0; + this._sphereShader.rangeMax = transitionBuffer.length - 1; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.selectedColor = this._core.config.selectionColor; + this._sphereShader.hoverColor = this._core.config.hoverColor; + this._sphereShader.activeColor = this._core.config.activeColor; + this._sphereShader.highlightMode = this._core.config.highlightMode; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.ambient = this._config.ambient; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sphereShader.directionToLight = this._directionToLight; + this._sphereShader.halfAngle = this._halfAngle; + } else { + this._sphereShader.directionToLight = this._config.directionToLight; + this._sphereShader.halfAngle = this._config.halfAngle; + } + this._sphereShader.vMatrix = vMatrix; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = 0; + this._cylinderShader.rangeMax = transitionBuffer.length - 1; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.selectedColor = this._core.config.selectionColor; + this._cylinderShader.hoverColor = this._core.config.hoverColor; + this._cylinderShader.activeColor = this._core.config.activeColor; + this._cylinderShader.highlightMode = this._core.config.highlightMode; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.ambient = this._config.ambient; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._cylinderShader.directionToLight = this._directionToLight; + this._cylinderShader.halfAngle = this._halfAngle; + } else { + this._cylinderShader.directionToLight = this._config.directionToLight; + this._cylinderShader.halfAngle = this._config.halfAngle; + } + this._cylinderShader.vMatrix = vMatrix; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { + this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; + this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._hexPrismShader.prepare(); + this._hexPrismShader.mMatrix = this.mMatrix; + this._hexPrismShader.time = this.transitionTime; + this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._hexPrismShader.rangeMin = 0; + this._hexPrismShader.rangeMax = transitionBuffer.length - 1; + this._hexPrismShader.hover = hoverId; + this._hexPrismShader.active = activeId; + this._hexPrismShader.selectedColor = this._core.config.selectionColor; + this._hexPrismShader.hoverColor = this._core.config.hoverColor; + this._hexPrismShader.activeColor = this._core.config.activeColor; + this._hexPrismShader.highlightMode = this._core.config.highlightMode; + this._hexPrismShader.specularPower = this._config.specularPower; + this._hexPrismShader.specularIntensity = this._config.specularIntensity; + this._hexPrismShader.ambient = this._config.ambient; + this._hexPrismShader.apply(); + this._hexPrismShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._hexPrismShader.directionToLight = this._directionToLight; + this._hexPrismShader.halfAngle = this._halfAngle; + } else { + this._hexPrismShader.directionToLight = this._config.directionToLight; + this._hexPrismShader.halfAngle = this._config.halfAngle; + } + this._hexPrismShader.vMatrix = vMatrix; + this._hexPrismShader.pMatrix = this.pMatrices[viewport]; + this._hexPrismShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._hexPrismShader.isPickShader = true; + this._hexPrismShader.pMatrix = this.pickPMatrix; + this._hexPrismShader.vMatrix = this.pickVMatrix; + this._hexPrismShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = 0; + this._sdfShader.rangeMax = transitionBuffer.length - 1; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.selectedColor = this._core.config.selectionColor; + this._sdfShader.hoverColor = this._core.config.hoverColor; + this._sdfShader.activeColor = this._core.config.activeColor; + this._sdfShader.highlightMode = this._core.config.highlightMode; + this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 255; + this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.ambient = this._config.ambient; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sdfShader.directionToLight = this._directionToLight; + this._sdfShader.halfAngle = this._halfAngle; + } else { + this._sdfShader.directionToLight = this._config.directionToLight; + this._sdfShader.halfAngle = this._config.halfAngle; + } + this._sdfShader.vMatrix = vMatrix; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basic/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/components/quad.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Quad = class { + get isInitialized() { + return this._isInitialized; + } + get vertexBuffer() { + return this._vertexBuffer; + } + get indexBuffer() { + return this._indexBuffer; + } + get indexCount() { + return this._indexCount; + } + initializeContext(gl) { + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$7(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/atlas.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Atlas = class extends AtlasBase { + get texture() { + return this._texture; + } + get defaultTexture() { + return this._defaultTexture; + } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ + 255, + 255, + 255, + 255 + ])); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._imageData) this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + else this._texture = null; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/palette.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Palette$1 = class extends PaletteBase { + get texture() { + return this._texture; + } + get defaultTexture() { + return this._defaultTexture; + } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._colors) { + const colors = new Uint8Array(this._colors); + for (let i = 0; i < colors.length; i++) colors[i] = Math.pow(colors[i] / 255, 2.2) * 255; + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); + } else this._texture = null; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/buffer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Buffer$1 = class extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; + } + constructor(core, ids) { + super(core, ids); + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update() { + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + } + }; + var TransitionBuffer = class extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$1, Palette$1, Atlas); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/config.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Config = class extends RendererConfig { + get keyLightAltitude() { + return this._keyLightAltitude; + } + set keyLightAltitude(value) { + this._keyLightAltitude = value; + this._updateLights(); + } + get keyLightAzimuth() { + return this._keyLightAzimuth; + } + set keyLightAzimuth(value) { + this._keyLightAzimuth = value; + this._updateLights(); + } + get keyLightDistance() { + return this._keyLightDistance; + } + set keyLightDistance(value) { + this._keyLightDistance = value; + this._updateLights(); + } + get fillLight1Altitude() { + return this._fillLight1Altitude; + } + set fillLight1Altitude(value) { + this._fillLight1Altitude = value; + this._updateLights(); + } + get fillLight1Azimuth() { + return this._fillLight1Azimuth; + } + set fillLight1Azimuth(value) { + this._fillLight1Azimuth = value; + this._updateLights(); + } + get fillLight2Altitude() { + return this._fillLight2Altitude; + } + set fillLight2Altitude(value) { + this._fillLight2Altitude = value; + this._updateLights(); + } + get fillLight2Azimuth() { + return this._fillLight2Azimuth; + } + set fillLight2Azimuth(value) { + this._fillLight2Azimuth = value; + this._updateLights(); + } + constructor() { + super(); + this._rotation = create$4(); + this.keyLightPosition = create$6(); + this.fillLight1Position = create$6(); + this.fillLight2Position = create$6(); + this.reset(); + } + _updateLights() { + this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); + this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); + this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); + } + _updateLight(altitude, azimuth, distance, position) { + rotateY(this._rotation, Constants$2.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); + rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); + transformQuat(position, Constants$2.VECTOR3_UNITZ, this._rotation); + scale$5(position, position, distance); + } + reset() { + this.isSsaoEnabled = true; + this.ssaoWidth = 1024; + this.ssaoHeight = 1024; + this.ssaoBlurEnabled = true; + this.ssaoKernelSize = 8; + this.ssaoNoiseSize = 4; + this.ssaoRadius = .02; + this.ssaoPower = 1; + this.isShadowEnabled = true; + this.shadowWidth = 1024; + this.shadowHeight = 1024; + this.isDofEnabled = false; + this.dofAutoFocus = true; + this.dofFocusDistance = .5; + this.dofFocusRange = .5; + this.dofMaxBackgroundBlur = .75; + this.isBloomEnabled = false; + this.bloomIntensity = 2; + this.specularIntensity = .15; + this.specularPower = 150; + this.ambientIntensity = .1; + this.materialIntensity = .5; + this.keyLightIntensity = 1.5; + this.fillLight1Intensity = .25; + this.fillLight2Intensity = .25; + this._keyLightAltitude = 30; + this._keyLightAzimuth = -45; + this._keyLightDistance = 1; + this._fillLight1Altitude = 30; + this._fillLight1Azimuth = 45; + this._fillLight2Altitude = 30; + this._fillLight2Azimuth = -135; + this._updateLights(); + this.isFxaaEnabled = false; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/shader.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Resources = class { + bindFramebuffer(framebuffer) { + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } + } + initializeContext(gl) { + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.OES_texture_float = gl.getExtension("OES_texture_float"); + this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + }; + Resources.glsl = { + "background.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n", + "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", + "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", + "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", + "deferred.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n", + "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", + "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", + "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", + "fxaa.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n", + "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", + "lasso.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", + "pickgrid.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n", + "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", + "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", + "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", + "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", + "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", + "texture.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n", + "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", + "unitblock.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", + "unitblock.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unitcylinder.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", + "unitcylinder.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unitsdf.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n", + "unitsdf.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", + "unitsphere.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", + "unitsphere.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", + "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", + "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" + }; + var ShaderBase = class { + get isInitialized() { + return this._isInitialized; + } + get vertexBuffer() { + return this._vertexBuffer; + } + set vertexBuffer(value) { + if (this._vertexBuffer != value) { + this._vertexBuffer = value; + this._haveBuffersChanged = true; + } + } + get indexBuffer() { + return this._indexBuffer; + } + set indexBuffer(value) { + if (this._indexBuffer != value) { + this._indexBuffer = value; + this._haveBuffersChanged = true; + } + } + constructor(core, main) { + this._core = core; + this._main = main; + } + initializeContext(gl) { + this._gl = gl; + } + _createProgram(vs, fs) { + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + return program; + } + _compileShader(source, type) { + const shader = this._gl.createShader(type); + this._gl.shaderSource(shader, source); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + return shader; + } + _removeDirective(shaderSource, directive) { + const remove = `#define ${directive}`; + const index = shaderSource.indexOf(remove); + shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); + return shaderSource; + } + prepare() { + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) this.updateBuffers(); + if (this._haveTexturesChanged) this.updateTextures(); + } + } + apply() {} + applyModel() {} + applyView() {} + enableProgram(program) { + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; + } + updateBuffers() { + this._haveBuffersChanged = false; + } + updateTextures() { + this._haveTexturesChanged = false; + } + disableProgram() { + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; + } + _shaderFromFile(vsName, fsName, callback) { + callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + } + _shaderFromUrl(vsName, fsName, callback) { + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); + }); + }); + }); + }); + } + _sourceFromUrl(url, callback) { + const request = new XMLHttpRequest(); + request.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request.onreadystatechange = () => { + if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); + }; + request.send(); + } + _includesFromFile(source) { + let index = 0; + do { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + const inc = Resources.glsl[name]; + source = source.substring(0, index) + inc + source.substring(end + 1); + } + } while (index != -1); + return source; + } + _includesFromUrl(source, index, callback) { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source = source.substring(0, index) + include + source.substring(end + 1); + this._includesFromUrl(source, index, callback); + }); + } else callback(source); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/texture.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Texture = class extends ShaderBase { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/lasso.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Lasso$1 = class extends ShaderBase { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; + } + apply() { + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + } + applyView() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/sdftext.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var SdfText = class extends ShaderBase { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyModel() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/pickgrid.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var PickGrid = class extends ShaderBase { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + ApplyFace() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/unitshader.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitShader = class extends ShaderBase { + get paletteTexture() { + return this._paletteTexture; + } + set paletteTexture(value) { + if (this._paletteTexture != value) { + this._paletteTexture = value; + this._haveTexturesChanged = true; + } + } + get previousPaletteTexture() { + return this._previousPaletteTexture; + } + set previousPaletteTexture(value) { + if (this._previousPaletteTexture != value) { + this._previousPaletteTexture = value; + this._haveTexturesChanged = true; + } + } + get sdfTexture() { + return this._sdfTexture; + } + set sdfTexture(value) { + if (this._sdfTexture != value) { + this._sdfTexture = value; + this._haveTexturesChanged = true; + } + } + get previousSdfTexture() { + return this._previousSdfTexture; + } + set previousSdfTexture(value) { + if (this._previousSdfTexture != value) { + this._previousSdfTexture = value; + this._haveTexturesChanged = true; + } + } + set instanceBuffer(value) { + if (this._instanceBuffer != value) { + this._instanceBuffer = value; + this._haveBuffersChanged = true; + } + } + set previousInstanceBuffer(value) { + if (this._previousInstanceBuffer != value) { + this._previousInstanceBuffer = value; + this._haveBuffersChanged = true; + } + } + initializeData() { + this._areBuffersInitialized = false; + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); + } + _updateCurrentBuffer() { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); + } + _updatePreviousBuffer() { + if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); + } + updateTextures() { + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._translationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); + this._gl.vertexAttribDivisor(this._scaleAttribute, 0); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); + this._gl.vertexAttribDivisor(this._colorAttribute, 0); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); + this._gl.vertexAttribDivisor(this._selectedAttribute, 0); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); + this._gl.vertexAttribDivisor(this._orderAttribute, 0); + this._gl.vertexAttribDivisor(this._idAttribute, 0); + this._gl.vertexAttribDivisor(this._idColorAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/unitblock.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitBlock = class extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/unitsphere.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitSphere = class extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/unitcylinder.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitCylinder = class extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/unitsdf.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var UnitSdf = class extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + apply() { + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/background.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Background = class extends ShaderBase { + constructor(core, main) { + super(core, main); + this._quad = new Quad(); + } + initializeContext(gl) { + super.initializeContext(gl); + this._quad.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._isInitialized = true; + this._vao = gl.createVertexArray(); + gl.bindVertexArray(this._vao); + gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); + gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + gl.enableVertexAttribArray(this._positionAttribute); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); + gl.bindVertexArray(null); + } + apply() { + this._gl.uniform3fv(this._colorUniform, this.color); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindVertexArray(this._vao); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/ssao.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Ssao = class extends ShaderBase { + get texture2D1() { + return this._texture2D1; + } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { + return this._texture2D2; + } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { + return this._texture2D3; + } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); + this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); + this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); + this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); + this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); + this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); + this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); + } + applyView() { + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/box.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Box = class extends ShaderBase { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/deferred.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Deferred = class extends ShaderBase { + get texture2D1() { + return this._texture2D1; + } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { + return this._texture2D2; + } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { + return this._texture2D3; + } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + get texture2D4() { + return this._texture2D4; + } + set texture2D4(value) { + if (this._texture2D4 != value) { + this._texture2D4 = value; + this._haveTexturesChanged = true; + } + } + get texture2D5() { + return this._texture2D5; + } + set texture2D5(value) { + if (this._texture2D5 != value) { + this._texture2D5 = value; + this._haveTexturesChanged = true; + } + } + constructor(core, main) { + super(core, main); + this.directionToKeyLight = create$6(); + this.directionToFillLight1 = create$6(); + this.directionToFillLight2 = create$6(); + this.keyLightHalfAngle = create$6(); + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); + this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); + this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); + this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); + this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); + this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); + this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); + this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); + this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); + this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); + this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); + this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); + this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); + this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); + this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); + this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); + this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); + this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); + this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); + this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); + this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); + this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); + this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); + this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); + this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/combine.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Combine = class extends ShaderBase { + get texture2D1() { + return this._texture2D1; + } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { + return this._texture2D2; + } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { + return this._texture2D3; + } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + get texture2D4() { + return this._texture2D4; + } + set texture2D4(value) { + if (this._texture2D4 != value) { + this._texture2D4 = value; + this._haveTexturesChanged = true; + } + } + get texture2D5() { + return this._texture2D5; + } + set texture2D5(value) { + if (this._texture2D5 != value) { + this._texture2D5 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1f(this._intensityUniform, this.intensity); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/dofblur.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var DofBlur = class extends ShaderBase { + get texture2D1() { + return this._texture2D1; + } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { + return this._texture2D2; + } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); + this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); + this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); + this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); + this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/downsample.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Downsample = class extends ShaderBase { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/gaussian.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Gaussian = class extends ShaderBase { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/dofcombine.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var DofCombine = class extends ShaderBase { + get texture2D1() { + return this._texture2D1; + } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { + return this._texture2D2; + } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { + return this._texture2D3; + } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._apertureUniform, this.aperture); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/fxaa.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Fxaa = class extends ShaderBase { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/shaders/bright.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Bright = class extends ShaderBase { + get texture2D() { + return this._texture2D; + } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); + else this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/components/axes/axes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var AxesVisualBase = class { + get isInitialized() { + return this._isInitialized; + } + get axes() { + return this._axes; + } + constructor(core) { + this._core = core; + this.isVisible = true; + } + initializeContext(gl) { + this._gl = gl; + } + update(elapsedTime) {} + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() {} + _renderText() {} + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/components/axes/cartesian2d.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cartesian2dVisual = class extends AxesVisualBase { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) axes.initialize(); + if (axes.gridVertices) this._createGridBuffers(); + if (axes.textVertices) this._createTextBuffers(); + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + _renderGrid() { + const gridShader = this._main.gridShader; + const axes = this._axes; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/components/axes/cartesian3d.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Cartesian3dVisual = class extends AxesVisualBase { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) axes.initialize(); + if (axes.gridVertices) this._createGridBuffers(); + if (axes.textVertices) this._createTextBuffers(); + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/font.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var FontVisual = class { + get isInitialized() { + return this._isInitialized; + } + get font() { + return this._font; + } + constructor(core, font) { + this._core = core; + this._font = font; + font.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) this._hasChanged = true; + } + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/components/labels.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var LabelVisualBase = class { + get isInitialized() { + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; + } + constructor(core, main, label) { + this._core = core; + this._main = main; + this._label = label; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$7(); + this.mMatrix = create$7(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._label.isInitialized) this._label.initialize(); + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + } + }; + var LabelVisual = class extends LabelVisualBase { + get label() { + return this._label; + } + set text(value) { + this._label.text = value; + } + get text() { + return this._label.text; + } + constructor(core, main, label) { + super(core, main, label); + } + }; + var LabelSetVisual = class extends LabelVisualBase { + get label() { + return this._label; + } + constructor(core, main, label) { + super(core, main, label); + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/components/image.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ImageVisual = class { + get isInitialized() { + return this._isInitialized && this._main.textureShader.isInitialized; + } + get image() { + return this._image; + } + constructor(core, main, image) { + this._core = core; + this._main = main; + this._image = image; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$7(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._image.isInitialized) this._image.initialize(); + this._gl = gl; + if (this._image.imageData) this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.apply(); + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/components/lasso.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Lasso = class { + get isInitialized() { + return this._isInitialized; + } + get vertexBuffer() { + return this._vertexBuffer; + } + get indexBuffer() { + return this._indexBuffer; + } + get indexCount() { + return this._indexCount; + } + initializeContext(gl) { + const vertices = Quad$2.textured(Constants$2.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + }; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/advanced/main.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter$3 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + 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) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var Main = class extends RendererBase { + get shaderResources() { + return this._shaderResources; + } + get textureShader() { + return this._textureShader; + } + get lassoShader() { + return this._lassoShader; + } + get sdfTextShader() { + return this._sdfTextShader; + } + get gridShader() { + return this._gridShader; + } + get blockShader() { + return this._blockShader; + } + get sphereShader() { + return this._sphereShader; + } + get cyclinderShader() { + return this._cylinderShader; + } + get sdfShader() { + return this._sdfShader; + } + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; + } + set currentAxes(value) { + if (this._isAxes1Current) this._axes1 = value; + else this._axes2 = value; + } + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; + } + set previousAxes(value) { + if (this._isAxes1Current) this._axes2 = value; + else this._axes1 = value; + } + get config() { + return this._config; + } + constructor(options) { + super(options); + this._config = new Config(); + this._quad = new Quad(); + this._lasso = new Lasso(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$5(); + this._position = create$6(); + this._direction = create$6(); + this._cameraRotation = create$8(); + this._cameraPosition = create$6(); + this._modelPosition = create$6(); + this._modelManipulationOrigin = create$6(); + this._shadowVMatrix = create$7(); + this._shadowPMatrix = create$7(); + } + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; + } + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources(); + this._textureShader = new Texture(core, this); + this._lassoShader = new Lasso$1(core, this); + this._sdfTextShader = new SdfText(core, this); + this._gridShader = new PickGrid(core, this); + this._blockShader = new UnitBlock(core, this); + this._sphereShader = new UnitSphere(core, this); + this._cylinderShader = new UnitCylinder(core, this); + this._sdfShader = new UnitSdf(core, this); + this._backgroundShader = new Background(core, this); + this._ssaoShader = new Ssao(core, this); + this._boxShader = new Box(core, this); + this._deferredShader = new Deferred(core, this); + this._combineShader = new Combine(core, this); + this._dofBlurShader = new DofBlur(core, this); + this._downsampleShader = new Downsample(core, this); + this._gaussianShader = new Gaussian(core, this); + this._dofCombineShader = new DofCombine(core, this); + this._fxaaShader = new Fxaa(core, this); + this._brightPassShader = new Bright(core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + event.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; + } + _initializeContext(gl) { + this._gl = gl; + for (const key in this.fonts) this.fonts[key].initializeContext(gl); + this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); + const random = new PseudoRandom(0); + const _vec3 = create$6(); + for (let i = 0; i < this._config.ssaoKernelSize; i++) { + _vec3[0] = random.nextFloat() * 2 - 1; + _vec3[1] = random.nextFloat() * 2 - 1; + _vec3[2] = random.nextFloat(); + normalize$5(_vec3, _vec3); + scale$5(_vec3, _vec3, random.nextFloat()); + let scale = i / this._config.ssaoKernelSize; + scale = MathHelper.lerp(.1, 1, scale * scale); + scale$5(_vec3, _vec3, scale); + this._ssaoSampleKernel[i * 3] = _vec3[0]; + this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; + this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; + } + const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); + _vec3[2] = 0; + for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { + _vec3[0] = random.nextFloat() * 2 - 1; + _vec3[1] = random.nextFloat() * 2 - 1; + normalize$5(_vec3, _vec3); + noise[i * 4] = _vec3[0]; + noise[i * 4 + 1] = _vec3[1]; + } + this._ssaoNoiseTexture = this._gl.createTexture(); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); + this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); + this._ssaoWidth = -1; + this._ssaoHeight = -1; + this._shadowWidth = -1; + this._shadowHeight = -1; + this._shaderResources.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._backgroundShader.initializeContext(this._gl); + this._ssaoShader.initializeContext(this._gl); + this._boxShader.initializeContext(this._gl); + this._deferredShader.initializeContext(this._gl); + this._combineShader.initializeContext(this._gl); + this._dofBlurShader.initializeContext(this._gl); + this._downsampleShader.initializeContext(this._gl); + this._gaussianShader.initializeContext(this._gl); + this._dofCombineShader.initializeContext(this._gl); + this._fxaaShader.initializeContext(this._gl); + this._brightPassShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + for (let i = 0; i < this.transitionBuffers.length; i++) this.transitionBuffers[i].initializeContext(this._gl); + if (this._axes1) for (let i = 0; i < this._axes1.length; i++) this._axes1[i].initializeContext(this._gl); + if (this._axes2) for (let i = 0; i < this._axes2.length; i++) this._axes2[i].initializeContext(this._gl); + for (let i = 0; i < this.labelSets.length; i++) this.labelSets[i].initializeContext(this._gl); + for (let i = 0; i < this.images.length; i++) this.images[i].initializeContext(this._gl); + } + _resize(width, height) { + super._resize(width, height); + this._positionTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); + this._colorTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._normalTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._geometryFrameBuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width, height); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._gl.drawBuffers([ + this._gl.COLOR_ATTACHMENT0, + this._gl.COLOR_ATTACHMENT1, + this._gl.COLOR_ATTACHMENT2 + ]); + this._postProcessTexture1 = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessDepthTexture = TextureHelper.create(this._gl, width, height, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); + this._postProcessTexture2 = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); + this._postProcessDofTexture = TextureHelper.create(this._gl, width, height, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); + this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); + const widthHalf = Math.round(width / 2); + const heightHalf = Math.round(height / 2); + this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); + this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); + this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); + this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); + const widthSixteenth = Math.round(widthEighth / 2); + const hgeightSixteenth = Math.round(heightEighth / 2); + this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); + this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); + this._core.log.write(LogLevel.info, `buffers resized ${width},${height}`); + } + _createContext(canvas) { + let supported = false; + const options = { + stencil: true, + alpha: false, + antialias: false, + preserveDrawingBuffer: this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false + }; + const gl = canvas.getContext("webgl2", options); + if (gl) { + const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); + if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { + const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); + const framebuffer = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) supported = true; + gl.bindTexture(gl.TEXTURE_2D, null); + } + } + return supported ? gl : null; + } + prepare() { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + break; + } + } + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + _createLabelVisual(label) { + return new LabelVisual(this._core, this, label); + } + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; + } + createImageVisual(image) { + const visual = new ImageVisual(this._core, this, image); + visual.initializeContext(this._gl); + return visual; + } + createFontVisual(font) { + const visual = new FontVisual(this._core, font); + visual.initializeContext(this._gl); + return visual; + } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); + } + update(elapsedTime) { + super.update(elapsedTime); + if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { + this._shadowWidth = this._config.shadowWidth; + this._shadowHeight = this._config.shadowHeight; + this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._shadowFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); + this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); + } + if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { + this._ssaoWidth = this._config.ssaoWidth; + this._ssaoHeight = this._config.ssaoHeight; + this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); + this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); + this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); + } + if (this._config.isDofEnabled && this._config.dofAutoFocus) { + this._core.getModelManipulationOrigin(this._modelManipulationOrigin); + this._core.getModelPosition(this._modelPosition); + add$4(this._position, this._modelManipulationOrigin, this._modelPosition); + this._core.camera.getPosition(this._cameraPosition); + subtract(this._position, this._position, this._cameraPosition); + const distance = -this._position[2]; + const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); + this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance, amount); + } + } + render(elapsedTime) { + return __awaiter$3(this, void 0, void 0, function* () { + this._gl.enable(this._gl.DEPTH_TEST); + this._gl.enable(this._gl.CULL_FACE); + this._gl.cullFace(this._gl.BACK); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); + if (this.config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.clear(this._gl.DEPTH_BUFFER_BIT); + perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + fromMat4(this._cameraRotation, this.inverseVMatrices[0]); + transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); + add$4(this._position, this._position, this._modelPosition); + lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants$2.VECTOR3_UNITY); + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) this._renderTransitionBuffer(transitionBuffer); + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.geometryFramebuffer = this._geometryFrameBuffer; + axesVisual.render(elapsedTime); + } + } + if (this.areLabelsVisible) for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; + labelSetVisual.render(elapsedTime); + } + } + if (this.areImagesVisible) for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.geometryFramebuffer = this._geometryFrameBuffer; + imageVisual.render(elapsedTime); + } + } + if (this._backgroundShader.isInitialized) { + this._backgroundShader.prepare(); + this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._backgroundShader.apply(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._gl.bindVertexArray(null); + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + } else { + set$7(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { + const viewport = this._viewportOffset; + this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + }); + } + _renderTransitionBuffer(transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = currentBuffer.from; + this._blockShader.rangeMax = currentBuffer.to; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._blockShader.vMatrix = this.vMatrices[viewport]; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = true; + this._blockShader.vMatrix = this._shadowVMatrix; + this._blockShader.pMatrix = this._shadowPMatrix; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.isShadowMap = false; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = currentBuffer.from; + this._sphereShader.rangeMax = currentBuffer.to; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sphereShader.vMatrix = this.vMatrices[viewport]; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = true; + this._sphereShader.vMatrix = this._shadowVMatrix; + this._sphereShader.pMatrix = this._shadowPMatrix; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.isShadowMap = false; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = currentBuffer.from; + this._cylinderShader.rangeMax = currentBuffer.to; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._cylinderShader.vMatrix = this.vMatrices[viewport]; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = true; + this._cylinderShader.vMatrix = this._shadowVMatrix; + this._cylinderShader.pMatrix = this._shadowPMatrix; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.isShadowMap = false; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = currentBuffer.from; + this._sdfShader.rangeMax = currentBuffer.to; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sdfShader.vMatrix = this.vMatrices[viewport]; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = true; + this._sdfShader.vMatrix = this._shadowVMatrix; + this._sdfShader.pMatrix = this._shadowPMatrix; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.isShadowMap = false; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + } + _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { + if (this._deferredShader.isInitialized) { + this._gl.disable(this._gl.DEPTH_TEST); + let ssaoTexture; + if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { + this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); + ssaoTexture = this._ssaoTexture1; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); + this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; + this._ssaoShader.indexBuffer = this._quad.indexBuffer; + this._ssaoShader.texture2D1 = this._positionTexture; + this._ssaoShader.texture2D2 = this._normalTexture; + this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; + this._ssaoShader.prepare(); + this._ssaoShader.pMatrix = pMatrix; + this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; + this._ssaoShader.ssaoRadius = this._config.ssaoRadius; + this._ssaoShader.ssaoPower = this._config.ssaoPower; + this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; + this._ssaoShader.left = 0; + this._ssaoShader.top = 0; + this._ssaoShader.width = this._config.ssaoWidth; + this._ssaoShader.height = this._config.ssaoHeight; + this._ssaoShader.apply(); + this._ssaoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { + ssaoTexture = this._ssaoTexture2; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); + this._boxShader.vertexBuffer = this._quad.vertexBuffer; + this._boxShader.indexBuffer = this._quad.indexBuffer; + this._boxShader.texture2D = this._ssaoTexture1; + this._boxShader.prepare(); + this._boxShader.left = 0; + this._boxShader.top = 0; + this._boxShader.width = this._config.ssaoWidth; + this._boxShader.height = this._config.ssaoHeight; + this._boxShader.apply(); + this._boxShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); + let postProcessFrameBuffer = this._postProcessFrameBuffer1; + this._shaderResources.bindFramebuffer(postProcessFrameBuffer); + this._deferredShader.vertexBuffer = this._quad.vertexBuffer; + this._deferredShader.indexBuffer = this._quad.indexBuffer; + this._deferredShader.texture2D1 = this._positionTexture; + this._deferredShader.texture2D2 = this._colorTexture; + this._deferredShader.texture2D3 = this._normalTexture; + this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; + this._deferredShader.texture2D5 = this._shadowDepthTexture; + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); + this._deferredShader.prepare(); + this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; + this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; + this._deferredShader.inverseVMatrix = inverseVMatrix; + this._deferredShader.shadowVMatrix = this._shadowVMatrix; + this._deferredShader.shadowPMatrix = this._shadowPMatrix; + this._deferredShader.vMatrix = vMatrix; + this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; + this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; + this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; + this._core.camera.getPosition(this._cameraPosition); + fromMat4(this._cameraRotation, vMatrix); + set$8(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + normalize$5(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); + subtract(this._direction, this._cameraPosition, this._position); + normalize$5(this._direction, this._direction); + add$4(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); + normalize$5(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); + copy$6(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); + copy$6(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); + this._deferredShader.left = viewport.left; + this._deferredShader.top = viewport.top; + this._deferredShader.width = viewport.width; + this._deferredShader.height = viewport.height; + this._deferredShader.shadowMapWidth = this._config.shadowWidth; + this._deferredShader.shadowMapHeight = this._config.shadowHeight; + this._deferredShader.ambientIntensity = this._config.ambientIntensity; + this._deferredShader.materialIntensity = this._config.materialIntensity; + this._deferredShader.specularPower = this._config.specularPower; + this._deferredShader.specularIntensity = this._config.specularIntensity; + this._deferredShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + const widthHalf = Math.round(viewport.width / 2); + const heightHalf = Math.round(viewport.height / 2); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + const widthSixteenth = Math.round(widthEighth / 2); + const heightSixteenth = Math.round(heightEighth / 2); + if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; + this._dofBlurShader.indexBuffer = this._quad.indexBuffer; + this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofBlurShader.texture2D2 = this._positionTexture; + this._dofBlurShader.prepare(); + this._dofBlurShader.focusDepth = this._config.dofFocusDistance; + this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; + this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; + this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; + this._dofBlurShader.left = viewport.left; + this._dofBlurShader.top = viewport.top; + this._dofBlurShader.width = viewport.width; + this._dofBlurShader.height = viewport.height; + this._dofBlurShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; + this._dofCombineShader.indexBuffer = this._quad.indexBuffer; + this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofCombineShader.texture2D2 = this._postProcessDofTexture; + this._dofCombineShader.prepare(); + this._dofCombineShader.focusDepth = this._config.dofFocusDistance; + this._dofCombineShader.left = viewport.left; + this._dofCombineShader.top = viewport.top; + this._dofCombineShader.width = viewport.width; + this._dofCombineShader.height = viewport.height; + this._dofCombineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthHalf; + this._brightPassShader.height = heightHalf; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessHalfTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthQuarter; + this._brightPassShader.height = heightQuarter; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessQuarterTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthEighth; + this._brightPassShader.height = heightEighth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessEighthTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthSixteenth; + this._brightPassShader.height = heightSixteenth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessHalfTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthHalf; + this._gaussianShader.height = heightHalf; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessHalfTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessQuarterTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthQuarter; + this._gaussianShader.height = heightQuarter; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessQuarterTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessEighthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthEighth; + this._gaussianShader.height = heightEighth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessEighthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthSixteenth; + this._gaussianShader.height = heightSixteenth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; + this._fxaaShader.indexBuffer = this._quad.indexBuffer; + this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._fxaaShader.prepare(); + this._fxaaShader.left = viewport.left; + this._fxaaShader.top = viewport.top; + this._fxaaShader.width = viewport.width; + this._fxaaShader.height = viewport.height; + this._fxaaShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._combineShader.vertexBuffer = this._quad.vertexBuffer; + this._combineShader.indexBuffer = this._quad.indexBuffer; + this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + if (this._config.isBloomEnabled) { + this._combineShader.texture2D2 = this._postProcessHalfTexture1; + this._combineShader.texture2D3 = this._postProcessQuarterTexture1; + this._combineShader.texture2D4 = this._postProcessEighthTexture1; + this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; + } else { + this._combineShader.texture2D2 = null; + this._combineShader.texture2D3 = null; + this._combineShader.texture2D4 = null; + this._combineShader.texture2D5 = null; + } + this._combineShader.prepare(); + this._combineShader.viewport = viewport; + this._combineShader.intensity = this._config.bloomIntensity; + this._combineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + }; + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/basicwebgpu/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/material.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var MaterialBufferData = class MaterialBufferData extends Float32Array { + constructor(count) { + super(count * MaterialBufferData.SIZE); + this.TYPE_OFFSET = 0 / 4; + this.FUZZ_OFFSET = 4 / 4; + this.REFRACTIVE_INDEX_OFFSET = 8 / 4; + this.TEXTURE_ID_OFFSET = 12 / 4; + this.COLOR_OFFSET = 16 / 4; + this.GLOSSINESS_OFFSET = 28 / 4; + this.ID_COLOR_OFFSET = 32 / 4; + this.DENSITY_OFFSET = 48 / 4; + } + getType(index) { + return this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getFuzz(index) { + return this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET]; + } + setFuzz(index, value) { + this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET] = value; + } + getRefractiveIndex(index) { + return this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET]; + } + setRefractiveIndex(index, value) { + this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET] = value; + } + getTextureId(index) { + return this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET]; + } + setTextureId(index, value) { + this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET] = value; + } + getColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getGlossiness(index) { + return this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET]; + } + setGlossiness(index, value) { + this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET] = value; + } + getDensity(index) { + return this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET]; + } + setDensity(index, value) { + this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET] = value; + } + getIdColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; + set$7(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setIdColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + }; + MaterialBufferData.SIZE = 64 / 4; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/texture.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var TextureBufferData = class TextureBufferData extends Float32Array { + constructor(count) { + super(count * TextureBufferData.SIZE); + this.COLOR0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.COLOR1_OFFSET = 16 / 4; + this.SIZE0_OFFSET = 32 / 4; + this.SIZE1_OFFSET = 48 / 4; + this.CLIP_OFFSET = 64 / 4; + this.OFFSET_OFFSET = 80 / 4; + } + getType(index) { + return this[TextureBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[TextureBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getColor0(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor0(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getColor1(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor1(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize0(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; + set$7(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setSize0(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getSize1(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; + set$7(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setSize1(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getClip(index, value) { + const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; + set$7(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setClip(index, value) { + const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getOffset(index, value) { + const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; + set$5(value, this[offset], this[offset + 1]); + } + setOffset(index, value) { + const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + } + }; + TextureBufferData.SIZE = 96 / 4; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/config.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/aabb.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/hittable.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var HittableBufferData = class HittableBufferData extends Float32Array { + constructor(count) { + super(count * HittableBufferData.SIZE); + this.CENTER0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.SIZE0_OFFSET = 16 / 4; + this.MATERIAL_ID_OFFSET = 28 / 4; + this.ROTATION0_OFFSET = 32 / 4; + this.ROTATION1_OFFSET = 48 / 4; + this.TEXCOORD0_OFFSET = 64 / 4; + this.TEXCOORD1_OFFSET = 72 / 4; + this.CENTER1_OFFSET = 80 / 4; + this.ROUNDING_OFFSET = 92 / 4; + this.SIZE1_OFFSET = 96 / 4; + this.BOUNDARY_TYPE_OFFSET = 108 / 4; + this.TIME0_OFFSET = 112 / 4; + this.TIME1_OFFSET = 116 / 4; + this.TEX_ID_OFFSET = 120 / 4; + this.SDF_BUFFER_OFFSET = 124 / 4; + this.SDF_BORDER_OFFSET = 128 / 4; + this.PARAMETER_1_OFFSET = 132 / 4; + this.PARAMETER_2_OFFSET = 136 / 4; + this.MATERIAL_FUZZ_OFFSET = 140 / 4; + this.MATERIAL_GLOSS_OFFSET = 144 / 4; + this.MATERIAL_DENSITY_OFFSET = 148 / 4; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; + this.MATERIAL_COLOR_OFFSET = 160 / 4; + this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; + this.SEGMENT_COLOR_OFFSET = 176 / 4; + this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; + this.TEXTURE_ID_OFFSET = 196 / 4; + } + getType(index) { + return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[HittableBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getCenter0(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter0(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getCenter1(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter1(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getTime0(index) { + return this[HittableBufferData.SIZE * index + this.TIME0_OFFSET]; + } + setTime0(index, value) { + this[HittableBufferData.SIZE * index + this.TIME0_OFFSET] = value; + } + getTime1(index) { + return this[HittableBufferData.SIZE * index + this.TIME1_OFFSET]; + } + setTime1(index, value) { + this[HittableBufferData.SIZE * index + this.TIME1_OFFSET] = value; + } + getSize0(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize0(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize1(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize1(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getRotation0(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; + set$6(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setRotation0(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getRotation1(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; + set$6(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setRotation1(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getTexCoord0(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; + set$5(value, this[offset], this[offset + 1]); + } + setTexCoord0(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + } + getTexCoord1(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; + set$5(value, this[offset], this[offset + 1]); + } + setTexCoord1(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + } + getRounding(index) { + return this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET]; + } + setRounding(index, value) { + this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET] = value; + } + getParameter1(index) { + return this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET]; + } + setParameter1(index, value) { + this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET] = value; + } + getParameter2(index) { + return this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET]; + } + setParameter2(index, value) { + this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET] = value; + } + getBoundaryType(index) { + return this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET]; + } + setBoundaryType(index, value) { + this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET] = value; + } + getTexId(index) { + return this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET]; + } + setTexId(index, value) { + this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET] = value; + } + getSdfBuffer(index) { + return this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET]; + } + setSdfBuffer(index, value) { + this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET] = value; + } + getSdfBorder(index) { + return this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET]; + } + setSdfBorder(index, value) { + this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; + } + getMaterialTypeId(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET]; + } + setMaterialTypeId(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET] = value; + } + getMaterialFuzz(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_FUZZ_OFFSET]; + } + setMaterialFuzz(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_FUZZ_OFFSET] = value; + } + getMaterialDensity(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_DENSITY_OFFSET]; + } + setMaterialDensity(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_DENSITY_OFFSET] = value; + } + getMaterialGloss(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_GLOSS_OFFSET]; + } + setMaterialGloss(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_GLOSS_OFFSET] = value; + } + getMaterialRefractiveIndex(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; + } + setMaterialRefractiveIndex(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value; + } + getMaterialColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.MATERIAL_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + } + setMaterialColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.MATERIAL_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSegmentColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.SEGMENT_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + value[3] = this[offset + 3]; + } + setSegmentColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.SEGMENT_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + }; + HittableBufferData.SIZE = 208 / 4; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/shaders/raytrace.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ComputeUniformBufferData = class ComputeUniformBufferData extends Float32Array { + constructor() { + super(ComputeUniformBufferData.SIZE); + this.POSITION_OFFSET = 0 / 4; + this.WIDTH_OFFSET = 12 / 4; + this.RIGHT_OFFSET = 16 / 4; + this.HEIGHT_OFFSET = 28 / 4; + this.UP_OFFSET = 32 / 4; + this.SEED_OFFSET = 44 / 4; + this.FORWARD_OFFSET = 48 / 4; + this.FOV_OFFSET = 60 / 4; + this.BACKGROUND_COLOR_OFFSET = 64 / 4; + this.TIME0_OFFSET = 76 / 4; + this.AMBIENT_COLOR_OFFSET = 80 / 4; + this.TIME1_OFFSET = 92 / 4; + this.TILES_X = 96 / 4; + this.TILES_Y = 100 / 4; + this.TILE_OFFSET_X = 104 / 4; + this.TILE_OFFSET_Y = 108 / 4; + this.LOOKAT_OFFSET = 112 / 4; + this.APERTURE_OFFSET = 124 / 4; + this.FOCUS_DISTANCE_OFFSET = 128 / 4; + this.RAYS_PER_FRAME_OFFSET = 132 / 4; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value) { + this[this.FOCUS_DISTANCE_OFFSET] = value; + } + getWidth() { + return this[this.WIDTH_OFFSET]; + } + setWidth(value) { + this[this.WIDTH_OFFSET] = value; + } + getHeight() { + return this[this.HEIGHT_OFFSET]; + } + setHeight(value) { + this[this.HEIGHT_OFFSET] = value; + } + getSeed() { + return this[this.SEED_OFFSET]; + } + setSeed(value) { + this[this.SEED_OFFSET] = value; + } + getRaysPerFrame() { + return this[this.RAYS_PER_FRAME_OFFSET]; + } + setRaysPerFrame(value) { + this[this.RAYS_PER_FRAME_OFFSET] = value; + } + getFieldOfView() { + return this[this.FOV_OFFSET]; + } + setFieldOfView(value) { + this[this.FOV_OFFSET] = value; + } + getAperture() { + return this[this.APERTURE_OFFSET]; + } + setAperture(value) { + this[this.APERTURE_OFFSET] = value; + } + getPosition(value) { + set$8(value, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); + } + setPosition(value) { + this[this.POSITION_OFFSET] = value[0]; + this[this.POSITION_OFFSET + 1] = value[1]; + this[this.POSITION_OFFSET + 2] = value[2]; + } + getRight(value) { + set$8(value, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); + } + setRight(value) { + this[this.RIGHT_OFFSET] = value[0]; + this[this.RIGHT_OFFSET + 1] = value[1]; + this[this.RIGHT_OFFSET + 2] = value[2]; + } + getUp(value) { + set$8(value, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); + } + setUp(value) { + this[this.UP_OFFSET] = value[0]; + this[this.UP_OFFSET + 1] = value[1]; + this[this.UP_OFFSET + 2] = value[2]; + } + getForward(value) { + set$8(value, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); + } + setForward(value) { + this[this.FORWARD_OFFSET] = value[0]; + this[this.FORWARD_OFFSET + 1] = value[1]; + this[this.FORWARD_OFFSET + 2] = value[2]; + } + getBackgroundColor(value) { + set$7(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); + } + setBackgroundColor(value) { + this[this.BACKGROUND_COLOR_OFFSET] = value[0]; + this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; + this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value[3]; + } + getAmbientColor(value) { + set$8(value, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); + } + setAmbientColor(value) { + this[this.AMBIENT_COLOR_OFFSET] = value[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value[2]; + } + getTime0() { + return this[this.TIME0_OFFSET]; + } + setTime0(value) { + this[this.TIME0_OFFSET] = value; + } + getTime1() { + return this[this.TIME1_OFFSET]; + } + setTime1(value) { + this[this.TIME1_OFFSET] = value; + } + getTilesX() { + return this[this.TILES_X]; + } + setTilesX(value) { + this[this.TILES_X] = value; + } + getTilesY() { + return this[this.TILES_Y]; + } + setTilesY(value) { + this[this.TILES_Y] = value; + } + getTileOffsetX() { + return this[this.TILE_OFFSET_X]; + } + setTileOffsetX(value) { + this[this.TILE_OFFSET_X] = value; + } + getTileOffsetY() { + return this[this.TILE_OFFSET_Y]; + } + setTileOffsetY(value) { + this[this.TILE_OFFSET_Y] = value; + } + getLookAt(value) { + set$8(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value) { + this[this.LOOKAT_OFFSET] = value[0]; + this[this.LOOKAT_OFFSET + 1] = value[1]; + this[this.LOOKAT_OFFSET + 2] = value[2]; + } + }; + ComputeUniformBufferData.SIZE = 144 / 4; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/shaders/fullscreenquad.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var FullscreenQuadUniformBufferData = class FullscreenQuadUniformBufferData extends Float32Array { + constructor() { + super(FullscreenQuadUniformBufferData.SIZE); + this.WIDTH_OFFSET = 0 / 4; + this.HEIGHT_OFFSET = 4 / 4; + this.SPP_OFFSET = 8 / 4; + this.EXPOSURE_OFFSET = 12 / 4; + this.MIN_DEPTH_OFFSET = 16 / 4; + this.MAX_DEPTH_OFFSET = 20 / 4; + this.EDGE_NORMAL_OFFSET = 24 / 4; + this.EDGE_DEPTH_OFFSET = 28 / 4; + this.EDGE_FOREGROUND_OFFSET = 32 / 4; + this.EDGE_BACKGROUND_OFFSET = 48 / 4; + } + getWidth() { + return this[this.WIDTH_OFFSET]; + } + setWidth(value) { + this[this.WIDTH_OFFSET] = value; + } + getHeight() { + return this[this.HEIGHT_OFFSET]; + } + setHeight(value) { + this[this.HEIGHT_OFFSET] = value; + } + getSamplesPerPixel() { + return this[this.SPP_OFFSET]; + } + setSamplesPerPixel(value) { + this[this.SPP_OFFSET] = value; + } + getExposure() { + return this[this.EXPOSURE_OFFSET]; + } + setExposure(value) { + this[this.EXPOSURE_OFFSET] = value; + } + getMinDepth() { + return this[this.MIN_DEPTH_OFFSET]; + } + setMinDepth(value) { + this[this.MIN_DEPTH_OFFSET] = value; + } + getMaxDepth() { + return this[this.MAX_DEPTH_OFFSET]; + } + setMaxDepth(value) { + this[this.MAX_DEPTH_OFFSET] = value; + } + getEdgeDepth() { + return this[this.EDGE_DEPTH_OFFSET]; + } + setEdgeDepth(value) { + this[this.EDGE_DEPTH_OFFSET] = value; + } + getEdgeNormal() { + return this[this.EDGE_NORMAL_OFFSET]; + } + setEdgeNormal(value) { + this[this.EDGE_NORMAL_OFFSET] = value; + } + getEdgeForeground(value) { + set$7(value, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); + } + setEdgeForeground(value) { + this[this.EDGE_FOREGROUND_OFFSET] = value[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value[3]; + } + getEdgeBackground(value) { + set$7(value, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); + } + setEdgeBackground(value) { + this[this.EDGE_BACKGROUND_OFFSET] = value[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value[3]; + } + }; + FullscreenQuadUniformBufferData.SIZE = 64 / 4; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/bvh.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var LinearBVHNodeBufferData = class LinearBVHNodeBufferData extends Float32Array { + constructor(count) { + super(count * LinearBVHNodeBufferData.SIZE); + this.CENTER_OFFSET = 0 / 4; + this.SIZE_OFFSET = 16 / 4; + this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; + this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; + this.N_PRIMITIVES_OFFSET = 32 / 4; + this.AXIS_OFFSET = 36 / 4; + } + getCenter(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getPrimitivesOffset(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET]; + } + setPrimitivesOffset(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET] = value; + } + getSecondChildOffset(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET]; + } + setSecondChildOffset(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET] = value; + } + getNPrimitives(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET]; + } + setNPrimitives(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET] = value; + } + getAxis(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET]; + } + setAxis(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET] = value; + } + }; + LinearBVHNodeBufferData.SIZE = 48 / 4; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/light.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var LightBufferData = class LightBufferData extends Float32Array { + constructor(count) { + super(count * LightBufferData.SIZE); + this.ROTATION_OFFSET = 0 / 4; + this.CENTER_OFFSET = 16 / 4; + this.TYPE_OFFSET = 28 / 4; + this.SIZE_OFFSET = 32 / 4; + this.COLOR_OFFSET = 48 / 4; + } + getType(index) { + return this[LightBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[LightBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getCenter(index, value) { + const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter(index, value) { + const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize(index, value) { + const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize(index, value) { + const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getColor(index, value) { + const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; + set$8(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor(index, value) { + const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getRotation(index, value) { + const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; + set$6(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setRotation(index, value) { + const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + }; + LightBufferData.SIZE = 64 / 4; + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/font.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/image.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/labels.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/buffer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/constants.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Constants$1 = class {}; + Constants$1.SHADOW_OFFSET = .001; + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/raytracewebgpu/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/renderers/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/tables/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/cameras/orbit.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/cameras/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../../node_modules/morphcharts/dist/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../vega-morphcharts/dist/es6/interfaces.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../vega-morphcharts/dist/es6/exports/types.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * This file is for external facing export only, do not use this for internal references, + * as it may cause circular dependencies in Rollup. + */ + var types_exports = /* @__PURE__ */ __exportAll({ MorphChartsCore: () => Core }); + //#endregion + //#region ../vega-morphcharts/dist/es6/array.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function concat$1(...args) { + return args.reduce((p, c) => c ? p.concat(c) : p, []); + } + /** + * Returns array with items which are truthy. + * @param args array or arrays to concat into a single array. + */ + function allTruthy$1(...args) { + return args.reduce((p, c) => c ? p.concat(c) : p, []).filter(Boolean); + } + /** + * Add an array to an existing array in place. + * @param arr Array to append to. + * @param items Arrof of items to append. + */ + function push$1(arr, items) { + arr.push.apply(arr, items); + } + //#endregion + //#region ../vega-morphcharts/dist/es6/htmlHelpers.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Create a new element as a child of another element. + * @param tagName Tag name of the new tag to create. + * @param parentElement Reference of the element to append to. + * @returns new HTMLElement. + */ + function addEl(tagName, parentElement) { + const el = document.createElement(tagName); + parentElement.appendChild(el); + return el; + } + /** + * Create a new div HTMLElement as a child of another element. + * @param parentElement Reference of the element to append to. + * @param className Optional css class name to apply to the div. + */ + function addDiv(parentElement, className) { + const div = addEl("div", parentElement); + if (className) div.className = className; + return div; + } + /** + * Measure the outer height and width of an HTMLElement, including margin, padding and border. + * @param el HTML Element to measure. + */ + function outerSize$1(el) { + const cs = getComputedStyle(el); + return { + height: parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom), + width: parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight) + }; + } + //#endregion + //#region ../../node_modules/deepmerge/dist/es.js + var es_exports = /* @__PURE__ */ __exportAll({ default: () => deepmerge_1 }); + var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) && !isSpecial(value); + }; + function isNonNullObject(value) { + return !!value && typeof value === "object"; + } + function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); + } + var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.element") : 60103; + function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE; + } + function emptyTarget(val) { + return Array.isArray(val) ? [] : {}; + } + function cloneUnlessOtherwiseSpecified(value, options) { + return options.clone !== false && options.isMergeableObject(value) ? deepmerge$1(emptyTarget(value), value, options) : value; + } + function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options); + }); + } + function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) Object.keys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + Object.keys(source).forEach(function(key) { + if (!options.isMergeableObject(source[key]) || !target[key]) destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + else destination[key] = deepmerge$1(target[key], source[key], options); + }); + return destination; + } + function deepmerge$1(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + var sourceIsArray = Array.isArray(source); + if (!(sourceIsArray === Array.isArray(target))) return cloneUnlessOtherwiseSpecified(source, options); + else if (sourceIsArray) return options.arrayMerge(target, source, options); + else return mergeObject(target, source, options); + } + deepmerge$1.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) throw new Error("first argument should be an array"); + return array.reduce(function(prev, next) { + return deepmerge$1(prev, next, options); + }, {}); + }; + var deepmerge_1 = deepmerge$1; + //#endregion + //#region ../../node_modules/is-plain-object/dist/is-plain-object.mjs + /*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + function isObject$1(o) { + return Object.prototype.toString.call(o) === "[object Object]"; + } + function isPlainObject(o) { + var ctor, prot; + if (isObject$1(o) === false) return false; + ctor = o.constructor; + if (ctor === void 0) return true; + prot = ctor.prototype; + if (isObject$1(prot) === false) return false; + if (prot.hasOwnProperty("isPrototypeOf") === false) return false; + return true; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/clone.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var deepmerge = deepmerge_1 || es_exports; + function clone(objectToClone) { + if (!objectToClone) return objectToClone; + return deepmerge.all([objectToClone]); + } + var dontMerge = (destination, source) => source; + function deepMerge(...objectsToMerge) { + const objects = objectsToMerge.filter(Boolean); + return deepmerge.all(objects, { + arrayMerge: dontMerge, + isMergeableObject: isPlainObject + }); + } + //#endregion + //#region ../vega-morphcharts/dist/es6/color.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function rgbToDeckglColor(c) { + return [ + c.r, + c.g, + c.b, + c.opacity * 255 + ]; + } + /** + * Compares 2 colors to see if they are equal. + * @param a RGBAColor to compare + * @param b RGBAColor to compare + * @returns True if colors are equal. + */ + function colorIsEqual(a, b) { + if (a.length !== b.length) return false; + for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false; + return true; + } + /** + * Convert a CSS color string to a Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.). + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ + function colorFromString(cssColorSpecifier) { + if (cssColorSpecifier) { + const dc = color$2(cssColorSpecifier); + if (dc) return rgbToDeckglColor(dc.rgb()); + } + } + /** + * Convert a Deck.gl color to a CSS rgba() string. + * @param color A Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.) + */ + function colorToString(color) { + const c = [...color]; + if (c.length > 3) c[3] /= 255; + return `rgba(${c.join(",")})`; + } + function desaturate(color, value) { + const hslColor = hsl$1(rgb(color[0], color[1], color[2], color[3] / 255)); + hslColor.s = value; + return rgbToDeckglColor(hslColor.rgb()); + } + //#endregion + //#region ../vega-morphcharts/dist/es6/exports/util.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * This file is for external facing export only, do not use this for internal references, + * as it may cause circular dependencies in Rollup. + */ + var util_exports$2 = /* @__PURE__ */ __exportAll({ + addDiv: () => addDiv, + addEl: () => addEl, + allTruthy: () => allTruthy$1, + clone: () => clone, + colorFromString: () => colorFromString, + colorIsEqual: () => colorIsEqual, + colorToString: () => colorToString, + concat: () => concat$1, + createElement: () => createElement, + deepMerge: () => deepMerge, + desaturate: () => desaturate, + getActiveElementInfo: () => getActiveElementInfo, + mount: () => mount, + outerSize: () => outerSize$1, + push: () => push$1, + setActiveElement: () => setActiveElement + }); + //#endregion + //#region ../vega-morphcharts/dist/es6/defaults.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var defaults_exports = /* @__PURE__ */ __exportAll({ + createStage: () => createStage, + defaultOnAxisItem: () => defaultOnAxisItem, + defaultPresenterConfig: () => defaultPresenterConfig, + defaultPresenterStyle: () => defaultPresenterStyle$1, + defaultView: () => "2d", + groupStrokeWidth: () => 1, + lineZ: () => 0, + min3dDepth: () => min3dDepth, + minHeight: () => minHeight, + minPixelSize: () => minPixelSize, + minWidth: () => minWidth, + minZ: () => minZ + }); + var minHeight = "100px"; + var minWidth = "100px"; + var defaultPresenterStyle$1 = { + cssPrefix: "vega-morphcharts-", + defaultCubeColor: [ + 128, + 128, + 128, + 255 + ], + highlightColor: [ + 0, + 0, + 0, + 255 + ] + }; + var defaultPresenterConfig = { + onCubeClick: (e, cube) => {}, + onCubeHover: (e, cube) => {}, + transitionDurations: { + position: 600, + stagger: 600, + view: 600 + }, + renderer: { + advanced: false, + advancedOptions: {}, + basicOptions: { antialias: true } + } + }; + function createStage(view) { + return { + view, + cubeData: [], + pathData: [], + axes: { + x: [], + y: [], + z: [] + }, + gridLines: [], + textData: [], + legend: { rows: {} }, + facets: [] + }; + } + var minZ = .5; + var min3dDepth = .05; + var minPixelSize = .5; + var zAxisEncodeColor = [ + 7, + 7, + 7, + 255 + ]; + var zAxisOutColor = [ + 0, + 0, + 0, + 255 + ]; + function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { + if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { + stageItem.color = zAxisOutColor; + if (currAxis.axisRole !== "z") { + if (removeCurrentAxes(stage, currAxis)) { + currAxis.axisRole = "z"; + stage.axes.z.push(currAxis); + } + } + } + } + function removeCurrentAxes(stage, currAxis) { + for (const axisRole in stage.axes) { + const axes = stage.axes[axisRole]; + for (let i = 0; i < axes.length; i++) if (axes[i] === currAxis) { + axes.splice(i, 1); + return axisRole; + } + } + } + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * References to dependency libraries. + */ + var base$3 = { vega: { + CanvasHandler: null, + inferType: null, + inferTypes: null, + loader: null, + parse: null, + read: null, + renderModule: null, + Renderer: null, + sceneVisit: null, + scheme: null, + truncate: null, + View: null + } }; + /** + * Specify the dependency libraries to use for rendering. + * @param vega Vega library. + */ + function use$5(vega) { + base$3.vega = vega; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/enums.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * HTML elements outputted by the presenter. + */ + var PresenterElement$1; + (function(PresenterElement) { + PresenterElement[PresenterElement["root"] = 0] = "root"; + PresenterElement[PresenterElement["gl"] = 1] = "gl"; + PresenterElement[PresenterElement["panel"] = 2] = "panel"; + PresenterElement[PresenterElement["legend"] = 3] = "legend"; + PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls"; + })(PresenterElement$1 || (PresenterElement$1 = {})); + //#endregion + //#region ../vega-morphcharts/dist/es6/legend.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var LegendView = (props) => { + const rows = []; + const addRow = (row, i) => { + const fn = symbolMap[row.symbol.shape]; + let jsx; + if (fn) jsx = fn(row.symbol); + else jsx = createElement("span", null, "x"); + rows.push({ cells: [{ + className: "symbol", + content: jsx + }, { + className: "label", + content: row.label, + title: row.label + }] }); + }; + const sorted = Object.keys(props.legend.rows).sort((a, b) => +a - +b); + sorted.forEach((i) => addRow(props.legend.rows[i], +i)); + if (sorted.length) return createElement(Table$1, { + rows, + rowClassName: "legend-row", + onRowClick: (e, i) => props.onClick(e, props.legend, i) + }, props.legend.title !== void 0 && createElement("tr", { onClick: (e) => props.onClick(e, props.legend, null) }, createElement("th", { colSpan: 2 }, props.legend.title))); + }; + var symbolMap = { square: function(symbol) { + return createElement("div", { style: { + height: `${symbol.bounds.y2 - symbol.bounds.y1}px`, + width: `${symbol.bounds.x2 - symbol.bounds.x1}px`, + backgroundColor: symbol.fill, + borderColor: symbol.fill + } }); + } }; + //#endregion + //#region ../vega-morphcharts/dist/es6/panel.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function initializePanel(presenter) { + mount(createElement("div", { className: className$1(PresenterElement$1.root, presenter) }, createElement("div", { + className: className$1(PresenterElement$1.gl, presenter), + style: { + minHeight, + minWidth + } + }), createElement("div", { className: className$1(PresenterElement$1.panel, presenter) }, createElement("div", { className: className$1(PresenterElement$1.vegaControls, presenter) }), createElement("div", { className: className$1(PresenterElement$1.legend, presenter) }))), presenter.el); + } + function className$1(type, presenter) { + return `${presenter.style.cssPrefix}${PresenterElement$1[type]}`; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/patchedCubeArray.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function patchCubeArray(allocatedSize, empty, cubes) { + const patched = new Array(allocatedSize); + patched.fill(empty); + cubes.forEach((cube) => patched[cube.ordinal] = cube); + return patched; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/marks/legend.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var legendMap = { + "legend-title": function(legend, textItem) { + legend.title = textItem.text; + }, + "legend-symbol": function(legend, symbol) { + const { bounds, fill, shape } = symbol; + const legendRowSymbol = { + bounds, + fill, + shape + }; + const i = symbol.datum.index; + legend.rows[i] = legend.rows[i] || {}; + legend.rows[i].symbol = legendRowSymbol; + }, + "legend-label": function(legend, label) { + const i = label.datum.index; + legend.rows[i] = legend.rows[i] || {}; + const row = legend.rows[i]; + row.label = label.text; + row.value = label.datum.value; + } + }; + var markStager$5 = (options, stage, scene, x, y, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const fn = legendMap[item.mark.role]; + if (fn) fn(stage.legend, item); + }); + }; + //#endregion + //#region ../vega-morphcharts/dist/es6/marks/image.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var markStager$4 = (options, stage, scene, x, y, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const { bounds, height, url, width } = item; + let { x1, x2, y1, y2 } = bounds; + x1 += x; + x2 += x; + y1 += y; + y2 += y; + if (!stage.backgroundImages) stage.backgroundImages = []; + stage.backgroundImages.push({ + bounds: { + x1, + x2, + y1, + y2 + }, + height, + url, + width + }); + }); + }; + //#endregion + //#region ../vega-morphcharts/dist/es6/marks/rect.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var markStager$3 = (options, stage, scene, x, y, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const noZ = item.z === void 0; + const z = noZ ? 0 : (item.z || 0) + minZ; + const depth = (noZ ? 0 : item.depth || 0) + min3dDepth; + const ty = -1; + const ordinal = options.assignCubeOrdinal(item.datum); + if (ordinal > options.maxOrdinal) options.maxOrdinal = ordinal; + if (ordinal === void 0) {} else { + const cube = { + ordinal, + size: [ + item.width, + item.height, + depth + ], + position: [ + x + (+item.x || 0), + ty * (y + (+item.y || 0)) - +item.height, + z + ], + color: colorFromString(item.fill) || options.defaultCubeColor || [ + 128, + 128, + 128, + 128 + ] + }; + cube.color[3] = item.opacity === void 0 ? 255 : 255 * item.opacity; + stage.cubeData.push(cube); + } + }); + }; + //#endregion + //#region ../vega-morphcharts/dist/es6/marks/rule.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var markStager$2 = (options, stage, scene, x, y, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const x1 = item.x || 0; + const y1 = item.y || 0; + const x2 = item.x2 != null ? item.x2 : x1; + const y2 = item.y2 != null ? item.y2 : y1; + const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth); + const { currAxis } = options; + if (options.modifyAxis) options.modifyAxis(item, lineItem, stage, currAxis); + if (item.mark.role === "axis-tick") currAxis.ticks.push(lineItem); + else if (item.mark.role === "axis-domain") currAxis.domain = lineItem; + else stage.gridLines.push(lineItem); + }); + }; + function styledLine(x1, y1, x2, y2, stroke, strokeWidth) { + return { + sourcePosition: [ + x1, + -y1, + 0 + ], + targetPosition: [ + x2, + -y2, + 0 + ], + color: colorFromString(stroke), + strokeWidth + }; + } + function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) { + const lines = [ + styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), + styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), + styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), + styledLine(gx, gy + height, gx, gy, stroke, strokeWidth) + ]; + if (diagonals) { + lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth)); + lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth)); + } + return lines; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/marks/line.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ty = -1; + var markStager$1 = (options, stage, scene, x, y, groupType) => { + const g = Object.assign({ + opacity: 1, + strokeOpacity: 1, + strokeWidth: 1 + }, scene.items[0]); + const path = { + strokeWidth: g.strokeWidth, + strokeColor: colorFromString(g.stroke), + positions: scene.items.map((it) => [ + it.x, + ty * it.y, + it.z || 0 + ]) + }; + path.strokeColor[3] *= g.strokeOpacity; + path.strokeColor[3] *= g.opacity; + stage.pathData.push(path); + }; + //#endregion + //#region ../vega-morphcharts/dist/es6/marks/text.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var markStager = (options, stage, scene, x, y, groupType) => { + const ty = -1; + base$3.vega.sceneVisit(scene, function(item) { + if (!item.text) return; + const size = item.fontSize; + const textItem = { + color: colorFromString(item.fill), + text: item.limit === void 0 ? item.text : base$3.vega.truncate(item.text, item.limit, "right", item.ellipsis || "..."), + position: [ + x + (item.x || 0), + ty * (y + (item.y || 0) + 0), + 0 + ], + size, + angle: convertAngle(item.angle), + metaData: item.metaData + }; + const { currAxis } = options; + if (options.modifyAxis) options.modifyAxis(item, textItem, stage, currAxis); + if (item.mark.role === "axis-label") { + const tickText = textItem; + tickText.value = item.datum.value; + currAxis.tickText.push(tickText); + } else if (item.mark.role === "axis-title") currAxis.title = textItem; + else stage.textData.push(textItem); + }); + }; + function convertAngle(vegaTextAngle) { + if (vegaTextAngle && !isNaN(vegaTextAngle)) return 360 - vegaTextAngle; + return 0; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/marks/interfaces.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var GroupType; + (function(GroupType) { + GroupType[GroupType["none"] = 0] = "none"; + GroupType[GroupType["legend"] = 1] = "legend"; + GroupType[GroupType["xAxis"] = 2] = "xAxis"; + GroupType[GroupType["yAxis"] = 3] = "yAxis"; + GroupType[GroupType["zAxis"] = 4] = "zAxis"; + })(GroupType || (GroupType = {})); + //#endregion + //#region ../vega-morphcharts/dist/es6/stagers.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getAxisGroupType(item, options) { + const axisItem = item; + const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; + if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== void 0) return GroupType.zAxis; + switch (axisItem.orient) { + case "bottom": + case "top": return GroupType.xAxis; + case "left": + case "right": return GroupType.yAxis; + } + } + function convertGroupRole(item, options) { + if (item.mark.role === "legend") return GroupType.legend; + if (item.mark.role === "axis") { + const groupType = getAxisGroupType(item, options); + if (groupType !== void 0) return groupType; + } + } + var group$1 = (options, stage, scene, x, y, groupType) => { + base$3.vega.sceneVisit(scene, function(g) { + const gx = g.x || 0, gy = g.y || 0; + if (g.context && g.context.background && !stage.backgroundColor) stage.backgroundColor = colorFromString(g.context.background); + if (g.stroke) { + const facetRect = { + datum: g.datum, + lines: box(gx + x, gy + y, g.height, g.width, g.stroke, 1) + }; + stage.facets.push(facetRect); + } + groupType = convertGroupRole(g, options) || groupType; + setCurrentAxis(options, stage, groupType); + base$3.vega.sceneVisit(g, function(item) { + mainStager(options, stage, item, gx + x, gy + y, groupType); + }); + }); + }; + function setCurrentAxis(options, stage, groupType) { + let axisRole; + switch (groupType) { + case GroupType.xAxis: + axisRole = "x"; + break; + case GroupType.yAxis: + axisRole = "y"; + break; + case GroupType.zAxis: + axisRole = "z"; + break; + default: return; + } + options.currAxis = { + axisRole, + domain: null, + tickText: [], + ticks: [] + }; + stage.axes[axisRole].push(options.currAxis); + } + var markStagers = { + group: group$1, + legend: markStager$5, + image: markStager$4, + rect: markStager$3, + rule: markStager$2, + line: markStager$1, + text: markStager + }; + var mainStager = (options, stage, scene, x, y, groupType) => { + if (scene.marktype !== "group" && groupType === GroupType.legend) markStager$5(options, stage, scene, x, y, groupType); + else { + const markStager = markStagers[scene.marktype]; + if (markStager) markStager(options, stage, scene, x, y, groupType); + } + }; + function sceneToStage(options, stage, scene) { + mainStager(options, stage, scene, 0, 0, null); + sortAxis(stage.axes.x, 0); + sortAxis(stage.axes.y, 1); + sortAxis(stage.axes.z, 1); + } + function sortAxis(axes, dim) { + axes.forEach((axis) => { + if (axis.domain) orderDomain(axis.domain, dim); + axis.ticks.sort((a, b) => a.sourcePosition[dim] - b.sourcePosition[dim]); + axis.tickText.sort((a, b) => a.position[dim] - b.position[dim]); + }); + } + function orderDomain(domain, dim) { + if (domain.sourcePosition[dim] > domain.targetPosition[dim]) { + const temp = domain.targetPosition; + domain.targetPosition = domain.sourcePosition; + domain.sourcePosition = temp; + } + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/bounds.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function outerBounds(b1, b2) { + if (!b1 && !b2) return; + if (!b1) return b2; + if (!b2) return b1; + const minProps = [ + "minBoundsX", + "minBoundsY", + "minBoundsZ" + ]; + const maxProps = [ + "maxBoundsX", + "maxBoundsY", + "maxBoundsZ" + ]; + const result = {}; + minProps.forEach((p) => result[p] = notNull(Math.min, b1[p], b2[p])); + maxProps.forEach((p) => result[p] = notNull(Math.max, b1[p], b2[p])); + return result; + } + function notNull(fn, v1, v2) { + if (v1 == null && v2 == null) return null; + if (v1 == null) return v2; + if (v2 == null) return v1; + return fn(v1, v2); + } + function increment$1(b, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { + return outerBounds(b, { + minBoundsX, + minBoundsY, + minBoundsZ, + maxBoundsX, + maxBoundsY, + maxBoundsZ + }); + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/axes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var createAxesLayer = (props) => { + const { config, height, ref, stage } = props; + const { core } = ref; + const { renderer } = core; + const { x, y, z } = stage.axes; + const xyz = [ + ...x, + ...y, + ...z + ]; + renderer.currentAxes = []; + if (!xyz.length) { + renderer.axesVisibility = AxesVisibility.none; + return; + } + renderer.axesVisibility = AxesVisibility.current; + const correlation = new AxesCorrelation(stage, 3); + const { axesSets, labels } = correlation; + const grid = correlation.getGrid(); + if (grid.byColumn[0]) { + grid.byColumn[0].forEach((row) => { + row.axesSet.showFacetTitleY = true; + }); + grid.byRow[0].forEach((col) => { + col.axesSet.showFacetTitleX = true; + }); + } + if (grid.rows > 1) { + const { byRow } = grid; + byRow[0].forEach(({ axesSet }, col) => { + if (!axesSet.y) { + if (byRow[1][col].axesSet) { + byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; + byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; + delete axesSet.x; + } + } + }); + } + let bounds; + const allAxesSetBounds = []; + let anyZ = false; + for (let i = 0; i < axesSets.length; i++) if (axesSets[i].z) { + anyZ = true; + break; + } + const is3d = stage.view === "3d" && anyZ; + axesSets.forEach((axesSet) => { + if (!axesSet.x && !axesSet.y) return; + const axesSetBounds = { + axesSet, + maxBoundsX: null, + maxBoundsY: null, + maxBoundsZ: null, + minBoundsX: null, + minBoundsY: null, + minBoundsZ: null + }; + if (is3d) { + const zBounds = getDomainBounds(1, axesSet.z); + axesSetBounds.minBoundsZ = -zBounds.maxBounds; + axesSetBounds.maxBoundsZ = -zBounds.minBounds; + } + const yBounds = getDomainBounds(1, axesSet.y); + axesSetBounds.minBoundsY = yBounds.minBounds; + axesSetBounds.maxBoundsY = yBounds.maxBounds; + axesSetBounds.y = yBounds.minBounds; + axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; + const xBounds = getDomainBounds(0, axesSet.x); + axesSetBounds.minBoundsX = xBounds.minBounds; + axesSetBounds.maxBoundsX = xBounds.maxBounds; + axesSetBounds.x = xBounds.minBounds; + axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; + allAxesSetBounds.push(axesSetBounds); + bounds = outerBounds(bounds, axesSetBounds); + }); + const facetLabelX = labels.filter((label) => label.axisRole === "x")[0]; + const facetLabelY = labels.filter((label) => label.axisRole === "y")[0]; + core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { + const axesSet = axesSets[axes]; + let a; + let f; + switch (axis) { + case 0: + a = axesSet.x; + f = facetLabelX; + break; + case 1: + a = axesSet.y; + f = facetLabelY; + break; + case 2: + a = axesSet.z; + break; + } + if (a) config.onTextClick(manipulator.event, a.title || f.title); + }; + allAxesSetBounds.forEach((axesSetBounds) => { + const { axesSet } = axesSetBounds; + if (!axesSet.x && !axesSet.y) return; + const cartesian = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); + cartesian.isDivisionPickingEnabled = [ + false, + false, + false + ]; + cartesian.arePickDivisionsVisible = [ + false, + false, + false + ]; + cartesian.isLabelPickingEnabled = [ + false, + false, + false + ]; + cartesian.isTitlePickingEnabled = [ + false, + false, + false + ]; + cartesian.isGridPickingEnabled = false; + cartesian.isHeadingPickingEnabled = [ + false, + false, + false + ]; + createAxes(cartesian, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height, props, axesSet.showFacetTitleX && facetLabelX); + createAxes(cartesian, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height, props, axesSet.showFacetTitleY && facetLabelY); + if (is3d) createAxes(cartesian, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height, props); + configCartesianAxes(is3d, bounds, cartesian); + const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds; + const w = maxBoundsX - minBoundsX; + const h = maxBoundsY - minBoundsY; + cartesian.scalingX = axesSetBounds.w / w; + cartesian.scalingY = axesSetBounds.h / h; + cartesian.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w - .5; + cartesian.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h - .5; + const aspect = h / w; + if (aspect > 1) cartesian.offsetX /= aspect; + else cartesian.offsetY *= aspect; + const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian) : renderer.createCartesian2dAxesVisual(cartesian); + renderer.currentAxes.push(axes); + props.config.onAxesComplete && props.config.onAxesComplete(cartesian); + }); + return { bounds }; + }; + var nullDomain = { + sourcePosition: [ + 0, + 0, + 0 + ], + targetPosition: [ + 0, + 0, + 0 + ] + }; + var AxesCorrelation = class { + constructor(stage, dimensions) { + this.dimensions = dimensions; + const { x, y, z } = stage.axes; + this.axesSets = []; + this.labels = []; + [ + x, + y, + z + ].forEach((axes) => { + axes.forEach((axis) => { + if (this.axesSets.length === 0) this.initialize(axis); + else this.correlate(axis); + }); + }); + } + getGrid() { + const mapCols = {}; + const mapRows = {}; + this.axesSets.forEach((axesSet) => { + var _a; + const domain = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; + if (!domain) return; + const col = domain.sourcePosition[0].toString(); + const row = domain.sourcePosition[1].toString(); + if (!mapCols[col]) mapCols[col] = {}; + mapCols[col][row] = axesSet; + mapRows[row] = null; + }); + const colKeys = Object.keys(mapCols).sort((a, b) => +a - +b); + const rowKeys = Object.keys(mapRows).sort((a, b) => +a - +b); + return { + cols: colKeys.length, + rows: rowKeys.length, + byColumn: colKeys.map((colKey) => rowKeys.map((rowKey) => { + return { + colKey, + rowKey, + axesSet: mapCols[colKey][rowKey] + }; + })), + byRow: rowKeys.map((rowKey) => colKeys.map((colKey) => { + return { + colKey, + rowKey, + axesSet: mapCols[colKey][rowKey] + }; + })) + }; + } + initialize(axis) { + if (!axis.domain) { + this.labels.push(axis); + return; + } + const axesSet = {}; + axesSet[axis.axisRole] = axis; + this.axesSets.push(axesSet); + } + correlate(axis) { + if (!axis.domain) { + this.labels.push(axis); + return; + } + for (let i = 0; i < this.axesSets.length; i++) { + const axesSet = this.axesSets[i]; + for (const axisRole in axesSet) { + const test = axesSet[axisRole]; + if (this.matchDomains(axis.domain, test.domain)) { + if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) axesSet[axis.axisRole] = axis; + return; + } + } + } + this.initialize(axis); + } + matchDomains(a, b) { + if (this.matchPoint(a.sourcePosition, b.sourcePosition)) return true; + if (this.matchPoint(a.sourcePosition, b.targetPosition)) return true; + if (this.matchPoint(a.targetPosition, b.targetPosition)) return true; + if (this.matchPoint(a.targetPosition, b.sourcePosition)) return true; + return false; + } + matchPoint(a, b) { + for (let i = 0; i < this.dimensions; i++) if (a[i] !== b[i]) return false; + return true; + } + }; + function createAxes(cartesian, dim2d, dim3d, axis, orientation, height, props, facetLabel) { + const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain, dim2d, height); + if (axis.axisRole === "z") { + tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); + textPos.forEach((t, i) => textPos[i] = 1 - t); + tickText.reverse(); + tickPositions.reverse(); + textPos.reverse(); + } + cartesian.setTickPositions(dim3d, tickPositions); + cartesian.zero[dim3d] = 0; + cartesian.setLabelPositions(dim3d, textPos); + cartesian.setLabels(dim3d, tickText); + cartesian.setLabelSizes(dim3d, textSize); + const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); + if (title === null || title === void 0 ? void 0 : title.text) { + cartesian.setTitle(dim3d, title.text); + cartesian.setTitleSize(dim3d, title.size / height); + } + cartesian.setLabelOrientation(dim3d, orientation); + props.config.onAxisConfig && props.config.onAxisConfig(cartesian, dim3d, axis); + return { tickText }; + } + function configCartesianAxes(is3d, bounds, cartesian) { + if (is3d) cartesian.isEdgeVisible[Edge3D.topBack] = false; + cartesian.isEdgeVisible[Edge3D.backRight] = false; + cartesian.isEdgeVisible[Edge3D.bottomRight] = false; + cartesian.isEdgeVisible[Edge3D.frontRight] = false; + cartesian.isEdgeVisible[Edge3D.topFront] = false; + cartesian.isEdgeVisible[Edge3D.topRight] = false; + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + cartesian.minBoundsX = minBoundsX; + cartesian.maxBoundsX = maxBoundsX; + cartesian.minBoundsY = minBoundsY; + cartesian.maxBoundsY = maxBoundsY; + if (is3d) { + cartesian.minBoundsZ = minBoundsZ; + cartesian.maxBoundsZ = maxBoundsZ; + } + } + function getDomainBounds(dim2d, axis) { + const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const minBounds = domain.sourcePosition[dim2d]; + return { + maxBounds: domain.targetPosition[dim2d], + minBounds + }; + } + function convertAxis(axis, domain, dim, height) { + const start = domain.sourcePosition[dim]; + const span = domain.targetPosition[dim] - start; + const tickPositions = axis ? axis.ticks.map((t) => (t.sourcePosition[dim] - start) / span) : []; + const tickText = axis ? axis.tickText.map((t) => t.text) : []; + const textPos = axis ? axis.tickText.map((t) => (t.position[dim] - start) / span) : []; + const textSize = axis ? axis.tickText.map((t) => t.size / height) : []; + if (tickPositions.length) { + if (tickPositions[0] !== 0) tickPositions[0] = 0; + if (tickPositions[tickPositions.length - 1] !== 1) tickPositions[tickPositions.length - 1] = 1; + } + return { + tickPositions, + tickText, + textPos, + textSize + }; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/color.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ColorMap$1 = class { + constructor(quant = 5) { + this.quant = quant; + this.colorMap = {}; + this.colorArray = []; + } + getColorKey(rgbaColor) { + const color = rgbaColor.slice(0, 3).map((e) => Math.floor(e / this.quant) * this.quant); + color[3] = rgbaColor[3]; + return JSON.stringify(color); + } + registerColor(rgbaColor) { + const colorKey = this.getColorKey(rgbaColor); + if (!this.colorMap[colorKey]) { + this.colorMap[colorKey] = { + index: this.colorArray.length, + rgbaColor + }; + this.colorArray.push(rgbaColor); + } + return this.colorMap[colorKey].index; + } + getPalette() { + return { + palette: new Uint8Array(this.colorArray.flat()), + maxColor: this.colorArray.length - 1 + }; + } + }; + function convert$3(newColor) { + return colorFromString(newColor).slice(0, 3).map((v) => v / 255); + } + function colorConfig(ref, colors) { + if (!colors) return; + const { config } = ref.core; + config.activeColor = convert$3(colors.activeItemColor); + config.backgroundColor = new Float32Array(convert$3(colors.backgroundColor)); + config.textColor = convert$3(colors.textColor); + config.textBorderColor = convert$3(colors.textBorderColor); + config.axesTextColor = convert$3(colors.axesTextLabelColor); + config.axesGridBackgroundColor = convert$3(colors.axesGridBackgroundColor); + config.axesGridHighlightColor = convert$3(colors.axesGridHighlightColor); + config.axesGridMinorColor = convert$3(colors.axesGridMinorColor); + config.axesGridMajorColor = convert$3(colors.axesGridMajorColor); + config.axesGridZeroColor = convert$3(colors.axesGridZeroColor); + ref.core.renderer["_theme"] = null; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/cubes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var key$2 = "cube"; + var createCubeLayer = (props) => { + const { ref, stage } = props; + const { core } = ref; + const scatter = new Scatter(core); + const { ids, colors, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds, maxColor, palette } = convert$2(stage); + if (!ids.length) return; + const { renderer } = core; + let cubeTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$2); + if (!cubeTransitionBuffer) { + cubeTransitionBuffer = renderer.createTransitionBuffer(ids); + cubeTransitionBuffer.key = key$2; + renderer.transitionBuffers.push(cubeTransitionBuffer); + } else cubeTransitionBuffer.swap(); + scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { + positionsX, + positionsY, + positionsZ + }); + const layer = { + positionsX, + positionsY, + positionsZ, + update: (newBounds, selected, stagger) => { + const { colors, maxColor, minColor, palette } = layer.unitColorMap; + const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$2); + currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; + currCubeTransitionBuffer.currentPalette.colors = palette; + let options = Object.assign({ + selected, + colors, + minColor, + maxColor, + sizesX, + sizesY, + sizesZ + }, newBounds); + if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { + const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; + options = Object.assign(Object.assign({}, options), { + maxStaggerOrder, + minStaggerOrder, + staggerOrders + }); + } + scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); + }, + bounds, + unitColorMap: { + colors, + ids, + minColor: 0, + maxColor, + palette + } + }; + return layer; + }; + function convert$2(stage) { + const { cubeData } = stage; + const { length } = cubeData; + const ids = []; + const colors = new Float64Array(length); + const positionsX = new Float64Array(length); + const positionsY = new Float64Array(length); + const positionsZ = new Float64Array(length); + const sizesX = new Float64Array(length); + const sizesY = new Float64Array(length); + const sizesZ = new Float64Array(length); + let bounds; + const colorMap = new ColorMap$1(); + cubeData.forEach((cube, i) => { + ids.push(i); + if (cube.isEmpty) { + positionsX[i] = 0; + positionsY[i] = 0; + positionsZ[i] = 0; + sizesX[i] = 0; + sizesY[i] = 0; + sizesZ[i] = 0; + colors[i] = 0; + } else { + positionsX[i] = cube.position[0] + cube.size[0] * .5; + positionsY[i] = cube.position[1] + cube.size[1] * .5; + positionsZ[i] = cube.position[2] + cube.size[2] * .5; + sizesX[i] = cube.size[0]; + sizesY[i] = cube.size[1]; + sizesZ[i] = cube.size[2]; + bounds = increment$1(bounds, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); + colors[i] = colorMap.registerColor(cube.color); + } + }); + const { palette, maxColor } = colorMap.getPalette(); + return { + ids: new Uint32Array(ids), + colors, + positionsX, + positionsY, + positionsZ, + sizesX, + sizesY, + sizesZ, + bounds, + maxColor, + palette + }; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/lines.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var key$1 = "line"; + var createLineLayer = (props) => { + const { height, ref, stage, width } = props; + const { core } = ref; + const lines = new Line(core); + const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert$1(stage, height, width); + if (!ids.length) return; + const { renderer } = core; + let lineTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$1); + if (!lineTransitionBuffer) { + lineTransitionBuffer = renderer.createTransitionBuffer(ids); + lineTransitionBuffer.key = key$1; + renderer.transitionBuffers.push(lineTransitionBuffer); + } else lineTransitionBuffer.swap(); + lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { + positionsX, + positionsY, + positionsZ, + lineSizes, + sizeScaling: 1 + }); + let options = { + lineColors, + lineMinColor: 0, + lineMaxColor + }; + lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; + lineTransitionBuffer.currentPalette.colors = palette; + return { + update: (newBounds) => { + options = Object.assign(Object.assign({}, options), newBounds); + const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$1); + lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); + }, + bounds, + unitColorMap: { + ids, + colors: lineColors, + minColor: 0, + maxColor: lineMaxColor, + palette + } + }; + }; + function convert$1(stage, height, width) { + const { pathData } = stage; + const positions = []; + const lines = []; + const colorMap = new ColorMap$1(); + pathData.forEach((path) => { + const color = colorMap.registerColor(path.strokeColor); + let from = positions.length; + positions.push(path.positions[0]); + for (let i = 1; i < path.positions.length; i++) { + const to = positions.length; + positions.push(path.positions[i]); + lines.push({ + id: lines.length, + from, + to, + color, + size: path.strokeWidth + }); + from = to; + } + }); + const ids = new Uint32Array(lines.length); + const fromIds = new Uint32Array(lines.length); + const toIds = new Uint32Array(lines.length); + const lineColors = new Float64Array(lines.length); + const lineSizes = new Float64Array(lines.length); + lines.forEach((line, i) => { + ids[i] = i; + fromIds[i] = line.from; + toIds[i] = line.to; + lineColors[i] = line.color; + lineSizes[i] = line.size; + }); + const positionsX = new Float64Array(positions.length); + const positionsY = new Float64Array(positions.length); + const positionsZ = new Float64Array(positions.length); + let bounds; + positions.forEach((p, i) => { + positionsX[i] = p[0]; + positionsY[i] = p[1] + height; + positionsZ[i] = p[2]; + bounds = increment$1(bounds, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); + }); + const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); + return { + ids, + fromIds, + toIds, + lineColors, + lineSizes, + bounds, + positionsX, + positionsY, + positionsZ, + lineMaxColor, + palette + }; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/text.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var createTextLayer = (props) => { + const { ref, stage } = props; + const { core } = ref; + const { positionsX, positionsY, positionsZ, sizes, bounds, maxGlyphs, text } = convert(stage); + if (text.length === 0) { + core.renderer.labelSets = []; + return; + } + const labelSet = new LabelSet(core, { + text, + maxGlyphs, + scales: sizes + }); + labelSet.positionsX = positionsX; + labelSet.positionsY = positionsY; + labelSet.positionsZ = positionsZ; + labelSet.horizontalAlignment = HorizontalAlignment.center; + labelSet.verticalAlignment = VerticalAlignment.center; + const layer = { + update: (bounds) => { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + labelSet.minBoundsX = minBoundsX; + labelSet.minBoundsY = minBoundsY; + labelSet.minBoundsZ = minBoundsZ; + labelSet.maxBoundsX = maxBoundsX; + labelSet.maxBoundsY = maxBoundsY; + labelSet.maxBoundsZ = maxBoundsZ; + }, + bounds + }; + const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); + core.renderer.labelSets = [labelSetVisual]; + return layer; + }; + function convert(stage) { + const { textData } = stage; + const { length } = textData; + const ids = []; + const text = []; + const colors = new Float64Array(length); + const positionsX = new Float64Array(length); + const positionsY = new Float64Array(length); + const positionsZ = new Float64Array(length); + const sizes = new Float64Array(length); + let bounds; + let maxGlyphs = 0; + const colorMap = new ColorMap$1(); + textData.forEach((t, i) => { + ids.push(i); + text.push(t.text); + maxGlyphs += t.text.length; + positionsX[i] = t.position[0]; + positionsY[i] = t.position[1]; + positionsZ[i] = t.position[2]; + sizes[i] = 1.5 * t.size; + bounds = increment$1(bounds, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); + colors[i] = colorMap.registerColor(t.color); + }); + const { palette, maxColor } = colorMap.getPalette(); + return { + ids: new Uint32Array(ids), + colors, + positionsX, + positionsY, + positionsZ, + sizes, + bounds, + maxColor, + maxGlyphs, + palette, + text + }; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/image.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getImageData(url) { + return new Promise((resolve, reject) => { + const imageElement = document.createElement("img"); + imageElement.onload = () => { + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext("2d"); + const { height, width } = imageElement; + canvas.width = width; + canvas.height = height; + ctx.drawImage(imageElement, 0, 0); + resolve(ctx.getImageData(0, 0, width, height)); + }; + imageElement.src = url; + }); + } + function createImageQuad(core, imageData, bounds, position, width, height) { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + return new ImageQuad(core, { + imageData, + position, + height, + width, + minBoundsX, + maxBoundsX, + minBoundsZ, + maxBoundsZ, + minBoundsY, + maxBoundsY + }); + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/defaults.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function createCameraDefaults() { + const qModelRotation2d = create$4(); + const qModelRotation3d = Constants$2.QUAT_ROTATEX_MINUS_90; + const qCameraRotation2d = create$4(); + const qCameraRotation3d = create$4(); + const qAngle = create$4(); + const vCameraPosition = create$6(); + setAxisAngle(qCameraRotation3d, Constants$2.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); + setAxisAngle(qAngle, Constants$2.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); + multiply(qCameraRotation3d, qCameraRotation3d, qAngle); + return { + qModelRotation2d, + qModelRotation3d, + qCameraRotation2d, + qCameraRotation3d, + vCameraPosition + }; + } + var cameraDefaults = createCameraDefaults(); + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/camera.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + function applyCameraCallbacks(ref, lastPresenterConfig, lastView, transistion2dOnly) { + const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref; + ref.reset = () => { + core.reset(true); + if (lastView === "3d") { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = qCameraRotation3d; + cameraTransitioner.vPosition.to = vCameraPosition; + } else { + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = qCameraRotation2d; + cameraTransitioner.vPosition.to = vCameraPosition; + } + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); + core.setModelRotation(modelTransitioner.qRotation.current, true); + core.camera.setOrbit(cameraTransitioner.qRotation.to, true); + core.camera.setPosition(cameraTransitioner.vPosition.to, true); + }; + const cam = (t) => { + slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); + lerp$1(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); + core.camera.setOrbit(cameraTransitioner.qRotation.current, false); + core.camera.setPosition(cameraTransitioner.vPosition.current, false); + core.inputManager.isPickingEnabled = false; + }; + core.updateCallback = (elapsedTime) => { + const { transitionDurations } = lastPresenterConfig; + if (positionTransitioner.isTransitioning) { + const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); + core.renderer.transitionTime = t; + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } else core.inputManager.isPickingEnabled = true; + if (modelTransitioner.isTransitioning) { + const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); + if (modelTransitioner.shouldTransition) { + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); + core.setModelRotation(modelTransitioner.qRotation.current, false); + } + cam(tm); + } + if (cameraTransitioner.isTransitioning) cam(cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true)); + }; + } + function setTransitionTimeAxesVisibility(transistion2dOnly, core) { + const t = core.renderer.transitionTime; + if (transistion2dOnly) if (t < .5) core.renderer.axesVisibility = AxesVisibility.previous; + else core.renderer.axesVisibility = AxesVisibility.current; + else if (t <= .01) core.renderer.axesVisibility = AxesVisibility.previous; + else if (t >= .99) core.renderer.axesVisibility = AxesVisibility.current; + else core.renderer.axesVisibility = AxesVisibility.none; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/render.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function morphChartsRender(ref, prevStage, stage, height, width, preStage, colors, config) { + const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref; + let transistion2dOnly = false; + let cameraTo; + let holdCamera; + if (config.camera === "hold") holdCamera = true; + else cameraTo = config.camera; + if (prevStage && prevStage.view !== stage.view) { + modelTransitioner.shouldTransition = !holdCamera; + if (stage.view === "2d") { + modelTransitioner.qRotation.from = qModelRotation3d; + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } else { + modelTransitioner.qRotation.from = qModelRotation2d; + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } + } else { + modelTransitioner.shouldTransition = false; + if (stage.view === "2d") { + transistion2dOnly = true; + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } else { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } + } + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + if (!prevStage) { + core.setModelRotation(modelTransitioner.qRotation.to, false); + core.camera.setOrbit(cameraTransitioner.qRotation.to, false); + core.camera.setPosition(cameraTransitioner.vPosition.to, false); + } else if (!holdCamera) cameraTransitioner.begin(); + positionTransitioner.begin(); + if (modelTransitioner.shouldTransition) modelTransitioner.begin(); + const props = { + ref, + stage, + height, + width, + config + }; + const cubeLayer = createCubeLayer(props); + const lineLayer = createLineLayer(props); + const textLayer = createTextLayer(props); + const { backgroundImages } = stage; + let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); + backgroundImages === null || backgroundImages === void 0 || backgroundImages.forEach((backgroundImage) => { + contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); + }); + props.bounds = contentBounds; + core.renderer.previousAxes = core.renderer.currentAxes; + const axesLayer = createAxesLayer(props); + core.config.transitionStaggering = config.transitionDurations.stagger; + core.config.transitionDuration = config.transitionDurations.position; + let bounds; + if (axesLayer && axesLayer.bounds) bounds = axesLayer.bounds; + else bounds = contentBounds; + ref.setMorphChartsRendererOptions(config.renderer); + if (preStage) preStage(stage, cubeLayer); + core.renderer.images = []; + if (backgroundImages) { + const addImage = (imageBounds, imageData) => { + const imageWidth = imageBounds.maxBoundsX - imageBounds.minBoundsX; + const imageHeight = imageBounds.maxBoundsY - imageBounds.minBoundsY; + const position = [ + imageBounds.minBoundsX + imageWidth / 2, + imageBounds.minBoundsY + imageHeight / 2, + 0 + ]; + const imageQuad = createImageQuad(core, imageData, contentBounds, position, imageWidth, imageHeight); + const imageVisual = core.renderer.createImageVisual(imageQuad); + core.renderer.images.push(imageVisual); + }; + const imageDataCache = {}; + backgroundImages.forEach((backgroundImage) => { + const imageBounds = convertBounds(backgroundImage.bounds); + const imageData = imageDataCache[backgroundImage.url]; + if (imageData) addImage(imageBounds, imageData); + else getImageData(backgroundImage.url).then((imageData) => { + imageDataCache[backgroundImage.url] = imageData; + addImage(imageBounds, imageData); + }); + }); + } + layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds, ref.layerStagger); + applyCameraCallbacks(ref, config, stage.view, transistion2dOnly); + core.renderer.transitionTime = 0; + colorConfig(ref, colors); + return { + bounds, + getCubeLayer: () => cubeLayer, + update: (layerSelection) => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, ref.layerStagger), + activate: (id) => core.renderer.transitionBuffers[0].activeId = id, + moveCamera: (camera) => { + if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + cameraTransitioner.move(camera.position, camera.rotation); + } + }, + setTransitionTimeAxesVisibility: () => { + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } + }; + } + function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, layerStagger) { + [ + { + layer: cubeLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes + }, + { + layer: lineLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines + }, + { + layer: textLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts + } + ].forEach((layerItem) => { + var _a; + return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds, layerItem.selection, layerItem.stagger); + }); + } + function convertBounds(bounds) { + if (!bounds) return; + return { + minBoundsX: bounds.x1, + maxBoundsX: bounds.x2, + minBoundsY: -bounds.y2, + maxBoundsY: -bounds.y1, + minBoundsZ: minZ, + maxBoundsZ: minZ + }; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/renderer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function shouldChangeRenderer(prev, next) { + var _a, _b; + if (!prev || !next) return true; + if (prev.advanced !== next.advanced) return true; + if (!prev.advanced) return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); + } + function getRenderer(mcRendererOptions, core) { + const r = (mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) ? new Main() : new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); + core.renderer = r; + setRendererOptions(r, mcRendererOptions); + return r; + } + function setRendererOptions(renderer, mcRendererOptions) { + const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; + if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) for (const key in o) renderer.config[key] = o[key]; + } + function rendererEnabled(advanced) { + return (advanced ? new Main() : new Main$1()).isSupported; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/canvas.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var rightButton = 2; + function listenCanvasEvents(core, options) { + const { container, pickGridCallback } = options; + const { inputManager } = core; + if (options.onLasso) inputManager.pickLassoCallback = (result) => { + options.onLasso(result.ids[0], result.manipulator.event); + }; + inputManager.singleTouchAction = (manipulator) => { + if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return SingleTouchAction.rotate; + else if (manipulator.altKey) return SingleTouchAction.lasso; + else return SingleTouchAction.translate; + }; + inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { + clearClickTimeout(); + const { altKey, button, shiftKey } = manipulator; + pickGridCallback([ + divisionX, + divisionY, + divisionZ + ], { + altKey, + shiftKey, + button + }); + }; + const canvas = container.getElementsByTagName("canvas")[0]; + let pickedId; + const hover = (e) => { + if (core.renderer.pickedId !== pickedId) { + pickedId = core.renderer.pickedId; + const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeHover(e, ordinal); + } + }; + canvas.addEventListener("mousemove", (e) => { + clearClickTimeout(); + if (mousedown) options.onCubeHover(e, null); + hover(e); + }); + canvas.addEventListener("mouseout", hover); + canvas.addEventListener("mouseover", hover); + let mousedown; + canvas.addEventListener("mousedown", () => { + mousedown = true; + }); + canvas.addEventListener("mouseup", (e) => { + mousedown = false; + }); + let canvasClickTimeout; + const clearClickTimeout = () => { + clearTimeout(canvasClickTimeout); + canvasClickTimeout = null; + }; + canvas.addEventListener("click", (e) => { + canvasClickTimeout = setTimeout(() => { + options.onCanvasClick(e); + }, 50); + }); + inputManager.pickItemCallback = ({ manipulator }) => { + clearClickTimeout(); + const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeClick(manipulator.event, ordinal); + }; + } + //#endregion + //#region ../vega-morphcharts/node_modules/d3-ease/src/cubic.js + function cubicInOut(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/easing.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function easing(t) { + if (t === 0 || t === 1) return t; + return cubicInOut(t); + } + //#endregion + //#region ../vega-morphcharts/dist/es6/transition.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Transitioner = class { + constructor() { + this.isTransitioning = false; + } + begin() { + this.isTransitioning = true; + this.time = 0; + } + elapse(elapsedTime, totalTime, ease = false) { + this.time += elapsedTime; + if (this.time >= totalTime) { + this.isTransitioning = false; + this.time = totalTime; + this.ended && this.ended(); + } + const t = this.time / totalTime; + return ease ? easing(t) : t; + } + }; + var CameraTransitioner = class extends Transitioner { + constructor() { + super(); + this.qRotation = { + from: create$4(), + to: null, + current: create$4() + }; + this.vPosition = { + from: create$6(), + to: null, + current: create$6() + }; + } + move(position, rotation) { + this.begin(); + this.qRotation.to = rotation; + this.vPosition.to = position; + } + }; + var ModelTransitioner = class extends Transitioner { + constructor() { + super(); + this.shouldTransition = false; + this.qRotation = { + from: null, + to: null, + current: create$4() + }; + } + }; + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/init.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function init$1(options, mcRendererOptions) { + const { container } = options; + const core = new Core({ container }); + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options); + core.config.pickSelectDelay = 50; + const cameraTransitioner = new CameraTransitioner(); + const modelTransitioner = new ModelTransitioner(); + const positionTransitioner = new Transitioner(); + positionTransitioner.ended = () => { + core.renderer.axesVisibility = AxesVisibility.current; + }; + const ref = { + supportedRenders: { + advanced: rendererEnabled(true), + basic: rendererEnabled(false) + }, + reset: null, + cameraTransitioner, + modelTransitioner, + positionTransitioner, + core, + setMorphChartsRendererOptions(mcRendererOptions) { + if (shouldChangeRenderer(ref.lastMorphChartsRendererOptions, mcRendererOptions)) { + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options); + } else if (mcRendererOptions.advanced) setRendererOptions(core.renderer, mcRendererOptions); + ref.lastMorphChartsRendererOptions = mcRendererOptions; + }, + lastMorphChartsRendererOptions: mcRendererOptions, + layerStagger: {} + }; + return ref; + } + //#endregion + //#region ../vega-morphcharts/dist/es6/morphcharts/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //#endregion + //#region ../vega-morphcharts/dist/es6/presenter.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Class which presents a Stage of chart data using MorphCharts to render. + */ + var Presenter = class { + /** + * Get the previously rendered Stage object. + */ + get stage() { + return this._last.stage; + } + /** + * Get the current View camera type. + */ + get view() { + return this._last.view; + } + /** + * Instantiate a new Presenter. + * @param el Parent HTMLElement to present within. + * @param style Optional PresenterStyle styling options. + */ + constructor(el, style) { + this.el = el; + this.style = deepMerge(defaultPresenterStyle$1, style); + initializePanel(this); + this._last = { + view: null, + height: null, + width: null, + cubeCount: null, + stage: null + }; + } + /** + * Cancels any pending animation, calling animationCanceled() on original queue. + */ + animationCancel() { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + if (this.logger) this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || "handler"}`); + if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) this.queuedAnimationOptions.animationCanceled.call(null); + } + } + /** + * Stops the current animation and queues a new animation. + * @param handler Function to invoke when timeout is complete. + * @param timeout Length of time to wait before invoking the handler. + * @param options Optional QueuedAnimationOptions object. + */ + animationQueue(handler, timeout, options) { + if (this.logger) this.logger(`queueing animation ${options && options.waitingLabel || "waiting"}...(${timeout})`); + this.animationCancel(); + this.animationTimer = setTimeout(() => { + if (this.logger) this.logger(`queueing animation ${options && options.handlerLabel || "handler"}...`); + handler(); + }, timeout); + } + /** + * Retrieve a sub-element of the rendered output. + * @param type PresenterElement type of the HTMLElement to retrieve. + */ + getElement(type) { + const elements = this.el.getElementsByClassName(className$1(type, this)); + if (elements && elements.length) return elements[0]; + } + /** + * Present the Vega Scene, or Stage object using Morphcharts. + * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. + * @param height Height of the rendering area. + * @param width Width of the rendering area. + * @param config Optional presentation configuration object. + */ + present(sceneOrStage, height, width, config) { + this.animationCancel(); + const scene = sceneOrStage; + let stage; + const options = { + maxOrdinal: 0, + currAxis: null, + defaultCubeColor: this.style.defaultCubeColor, + assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (() => options.maxOrdinal++), + modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, + zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex + }; + if (scene.marktype) { + stage = createStage(scene.view); + sceneToStage(options, stage, scene); + } else stage = sceneOrStage; + const c = deepMerge(defaultPresenterConfig, config); + if (!this.morphchartsref) { + this._morphChartsOptions = { + container: this.getElement(PresenterElement$1.gl), + pickGridCallback: c.axisPickGridCallback, + onCubeHover: (e, ordinal) => { + c.onCubeHover(e, { + ordinal, + color: null, + position: null, + size: null + }); + }, + onCubeClick: (e, ordinal) => { + c.onCubeClick(e, { + ordinal, + color: null, + position: null, + size: null + }); + }, + onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, + onLasso: config === null || config === void 0 ? void 0 : config.onLasso + }; + this.morphchartsref = init$1(this._morphChartsOptions, c.renderer || defaultPresenterConfig.renderer); + } + let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); + if (options.maxOrdinal) { + cubeCount = Math.max(cubeCount, options.maxOrdinal); + stage.cubeData = patchCubeArray(cubeCount, { isEmpty: true }, stage.cubeData); + } + config.preLayer && config.preLayer(stage); + this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height, width, config && config.preStage, config && config.morphChartsColors, c); + delete stage.cubeData; + delete stage.redraw; + this._last = { + cubeCount, + height, + width, + stage, + view: stage.view + }; + const a = getActiveElementInfo(); + mount(LegendView({ + legend: stage.legend, + onClick: config && config.onLegendClick + }), this.getElement(PresenterElement$1.legend)); + setActiveElement(a); + if (config && config.onPresent) config.onPresent(); + } + canvasToDataURL() { + return new Promise((resolve, reject) => { + this.morphchartsref.core.afterRenderCallback = () => { + this.morphchartsref.core.afterRenderCallback = null; + resolve(this.getElement(PresenterElement$1.gl).getElementsByTagName("canvas")[0].toDataURL("image/png")); + }; + }); + } + configColors(mcColors) { + colorConfig(this.morphchartsref, mcColors); + } + /** + * Home the camera to the last initial position. + */ + homeCamera() { + var _a; + (_a = this.morphchartsref) === null || _a === void 0 || _a.reset(); + } + /** + * Show guidelines of rendering height/width and center of OrbitView. + */ + showGuides() { + this.getElement(PresenterElement$1.gl).classList.add("show-center"); + } + finalize() { + this.animationCancel(); + if (this.morphchartsref) this.morphchartsref.core.stop(); + if (this.el) this.el.innerHTML = ""; + this._last = null; + this.morphchartsref = null; + this.el = null; + this.logger = null; + this.queuedAnimationOptions = null; + } + }; + //#endregion + //#region ../vega-morphcharts/dist/es6/vega-classes/rendererGl.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function _RendererGl(loader) { + class RendererGlInternal extends base$3.vega.Renderer { + initialize(el, width, height, origin) { + this.height = height; + this.width = width; + return super.initialize(el, width, height, origin); + } + resize(width, height, origin) { + super.resize(width, height, origin); + this.origin = origin; + this.height = height; + this.width = width; + return this; + } + _render(scene, items) { + const scene3d = scene; + scene3d.view = this.getView(); + this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); + return this; + } + } + return new RendererGlInternal(loader); + } + /** + * Subclass of Vega.Renderer, with added properties for accessing a Presenter. + * This is instantiated by ViewGl. + */ + var RendererGl = _RendererGl; + //#endregion + //#region ../vega-morphcharts/dist/es6/vega-classes/viewGl.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var registered = false; + function _ViewGl(runtime, config) { + class ViewGlInternal extends base$3.vega.View { + constructor(runtime, config = {}) { + super(runtime, config); + this.config = config; + this.presenter = config.presenter; + config.presenterConfig = config.presenterConfig || {}; + config.presenterConfig.redraw = () => { + this._redraw = true; + this.run(); + }; + } + renderer(...args) { + if (args && args.length) { + const renderer = args[0]; + if (renderer === "morphcharts" && !registered) { + base$3.vega.renderModule("morphcharts", { + handler: base$3.vega.CanvasHandler, + renderer: RendererGl + }); + registered = true; + } + return super.renderer(renderer); + } else return super.renderer(); + } + initialize(el) { + if (!this.presenter) this.presenter = new Presenter(el); + super.initialize(this.presenter.getElement(PresenterElement$1.vegaControls)); + const renderer = this._renderer; + renderer.presenterConfig = this.config.presenterConfig; + renderer.presenter = this.presenter; + renderer.getView = this.config && this.config.getView || (() => this.presenter.view || "2d"); + return this; + } + error(e) { + if (this.presenter.logger) this.presenter.logger(e); + } + } + return new ViewGlInternal(runtime, config); + } + /** + * Subclass of Vega.View, with added properties for accessing a Presenter. + * This is instantiatable by calling `new ViewGl()`. See https://vega.github.io/vega/docs/api/view/ + */ + var ViewGl = _ViewGl; + //#endregion + //#region ../vega-morphcharts/dist/es6/version.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var version$5 = "1.0.6"; + //#endregion + //#region ../vega-morphcharts/dist/es6/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var es6_exports$3 = /* @__PURE__ */ __exportAll({ + Presenter: () => Presenter, + PresenterElement: () => PresenterElement$1, + ViewGl: () => ViewGl, + base: () => base$3, + controls: () => controls_exports$1, + defaults: () => defaults_exports, + types: () => types_exports, + use: () => use$5, + util: () => util_exports$2, + version: () => version$5 + }); + //#endregion + //#region ../sanddance/dist/es6/defaults.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var { defaultPresenterStyle } = defaults_exports; + var defaultViewerOptions$1 = { + colors: { + activeCube: "purple", + defaultCube: colorToString(defaultPresenterStyle.defaultCubeColor), + hoveredCube: colorToString(defaultPresenterStyle.highlightColor), + selectedCube: "yellow", + axisSelectHighlight: colorToString([ + 128, + 128, + 128, + 128 + ]), + axisLine: "#000", + axisText: "#000", + gridLine: "#CCC", + backgroundColor: "#FFF" + }, + language: { + headers: { + chart: "Chart", + details: "Details", + legend: "Legend", + selection: "Select & Filter" + }, + bing: "bing", + newColorMap: "remap color to filtered items", + oldColorMap: "keep same colors", + deselect: "deselect", + exclude: "exclude", + isolate: "isolate", + legendOther: "other", + nextDetail: ">", + previousDetail: "<", + reset: "reset", + colorBinCount: "Color bin count", + colorReverse: "Color reverse", + count: "Count", + percent: "Percent", + sum: "Sum", + scatterPointScale: "Point scale", + FacetMaxBins: "Facet max bins", + FacetVMaxBins: "Cross facet max bins", + XMaxBins: "X axis max bins", + YMaxBins: "Y axis max bins", + XGridSize: "X grid size", + YGridSize: "Y grid size", + InnerPaddingSize: "Inner padding size", + OuterPaddingSize: "Outer padding size", + treeMapMethod: "Treemap layout", + facetColumns: "Facet columns", + facetRows: "Facet rows", + markOpacitySignal: "Mark opacity", + textScaleSignal: "Text scale", + xAxisTextAngleSignal: "X axis text angle", + yAxisTextAngleSignal: "Y axis text angle", + zGrounded: "Z grounded", + zScaleProportion: "Z scale proportion to Y", + selectionCount: (count) => `${count} items selected` + }, + maxLegends: 19, + onError: (errors) => {}, + filterRenderingTimerPadding: 200, + selectionPolygonZ: -1, + tickSize: 10 + }; + function getPresenterStyle(options) { + const style = { + cssPrefix, + fontFamily: options.fontFamily, + defaultCubeColor: colorFromString(options.colors.defaultCube) + }; + if (options.colors.hoveredCube) style.highlightColor = colorFromString(options.colors.hoveredCube); + return style; + } + var cssPrefix = "sanddance-"; + var dualColorSchemeColors = { + black: "#212121", + gray: "#D2D2D2", + blue: "#0060F0", + green: "#00C000", + orange: "#FF9900", + red: "#E00000" + }; + //#endregion + //#region ../sanddance/dist/es6/util.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var util_exports$1 = /* @__PURE__ */ __exportAll({ + getColumnsFromData: () => getColumnsFromData, + getPresenterStyle: () => getPresenterStyle, + getStats: () => getStats, + inferAll: () => inferAll, + isInternalFieldName: () => isInternalFieldName + }); + function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { + if (includeVegaMorphChartsFields) { + if (columnName === "GL_ORDINAL") return true; + } + for (const f in FieldNames) if (columnName === FieldNames[f]) return true; + return false; + } + //#endregion + //#region ../sanddance/dist/es6/colorSchemes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var dualPairs = [ + [dualColorSchemeColors.black, dualColorSchemeColors.gray], + [dualColorSchemeColors.red, dualColorSchemeColors.green], + [dualColorSchemeColors.red, dualColorSchemeColors.blue], + [dualColorSchemeColors.black, dualColorSchemeColors.red], + [dualColorSchemeColors.black, dualColorSchemeColors.orange], + [dualColorSchemeColors.black, dualColorSchemeColors.green] + ]; + /** + * Array of color schemes. + */ + var colorSchemes = [{ + scheme: ColorScaleNone, + colors: [defaultViewerOptions$1.colors.defaultCube] + }]; + createDualColorSchemes(); + function registerColorSchemes(vega) { + colorSchemes.forEach((cs) => { + if (cs.colors.length === 1) vega.scheme(cs.scheme, (x) => cs.colors[0]); + else vega.scheme(cs.scheme, cs.colors); + }); + } + function createPair(names, colors) { + const scheme = `dual_${names[0]}${names[1]}`; + colorSchemes.push({ + scheme, + colors + }); + } + function createDualColorSchemes() { + dualPairs.forEach((colors) => { + const names = colors.map((color) => { + for (const key in dualColorSchemeColors) if (color === dualColorSchemeColors[key]) return key; + }); + createPair(names, colors); + createPair([...names].reverse(), [...colors].reverse()); + }); + } + //#endregion + //#region ../sanddance/dist/es6/animator.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var DataLayoutChange; + (function(DataLayoutChange) { + DataLayoutChange[DataLayoutChange["same"] = 0] = "same"; + DataLayoutChange[DataLayoutChange["reset"] = 1] = "reset"; + DataLayoutChange[DataLayoutChange["refine"] = 2] = "refine"; + })(DataLayoutChange || (DataLayoutChange = {})); + var Animator = class { + constructor(dataScope, props) { + this.dataScope = dataScope; + this.props = props; + } + select(search) { + return new Promise((resolve, reject) => { + this.dataScope.select(search); + this.props.onDataChanged(DataLayoutChange.same); + resolve(); + }); + } + deselect() { + return new Promise((resolve, reject) => { + this.dataScope.deselect(); + this.props.onDataChanged(DataLayoutChange.same); + resolve(); + }); + } + filter(search, keepData, collapseData, rebase) { + if (rebase) this.dataScope.collapse(false, keepData); + this.dataScope.collapse(true, collapseData); + return new Promise((resolve, reject) => { + this.props.onAnimateDataChange(DataLayoutChange.refine, "before refine", "refine").then(() => { + this.dataScope.deselect(); + this.dataScope.setFilteredData(keepData); + this.props.onDataChanged(DataLayoutChange.refine, search); + resolve(); + }).catch(reject); + }); + } + reset() { + return new Promise((resolve, reject) => { + this.dataScope.deselect(); + let time; + if (!this.dataScope.hasFilteredData()) time = 0; + else this.dataScope.setFilteredData(null); + this.props.onAnimateDataChange(DataLayoutChange.reset, "before reset", "reset", time).then(() => { + this.dataScope.collapse(false); + this.props.onDataChanged(DataLayoutChange.reset); + resolve(); + }).catch(reject); + }); + } + activate(datum) { + return new Promise((resolve, reject) => { + this.dataScope.activate(datum); + this.props.onDataChanged(DataLayoutChange.same); + resolve(); + }); + } + deactivate() { + return new Promise((resolve, reject) => { + this.dataScope.deactivate(); + this.props.onDataChanged(DataLayoutChange.same); + resolve(); + }); + } + }; + //#endregion + //#region ../sanddance/dist/es6/expression.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function notNice(niceValue) { + return (niceValue + "").replace(/[\s,]/g, ""); + } + function tickValue(axis, i) { + const tick = axis.tickText[i]; + let value; + if (tick) value = axis.tickText[i].value; + return { + tick, + value + }; + } + function selectNullOrEmpty(column) { + return { + name: column.name, + operator: "isnullorEmpty" + }; + } + function selectExact(column, value) { + if (value == null) return selectNullOrEmpty(column); + return { + name: column.name, + operator: "==", + value + }; + } + function selectNone(column, values) { + return { expressions: values.map((value, i) => { + const searchExpression = { + name: column.name, + operator: "!=", + value + }; + if (i) searchExpression.clause = "&&"; + return searchExpression; + }) }; + } + function selectExactAxis(axis, column, i) { + const result = tickValue(axis, i); + if (result.tick) return selectExact(column, result.value); + } + function selectBetween(column, lowValue, highValue, lowOperator = ">=", highOperator = "<") { + const expressions = []; + if (lowValue !== void 0) expressions.push({ + name: column.name, + operator: lowOperator, + value: lowValue + }); + if (highValue !== void 0) expressions.push({ + name: column.name, + operator: highOperator, + value: highValue + }); + if (expressions.length > 1) expressions[1].clause = "&&"; + return { expressions }; + } + function selectBetweenAxis(axis, column, i) { + const low = tickValue(axis, i); + const high = tickValue(axis, i + 1); + return selectBetween(column, low.value, high.value); + } + //#endregion + //#region ../sanddance/dist/es6/axisSelection.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var dimToRole = { + 0: "x", + 1: "y", + 2: "z" + }; + var roleToDim = { + x: 0, + y: 1, + z: 1 + }; + var AxisSelection = class { + constructor(specCapabilities, columns, stage) { + this.specCapabilities = specCapabilities; + this.columns = columns; + this.stage = stage; + } + convert(divisions) { + const searchRoles = []; + divisions.forEach((division, i) => { + const role = dimToRole[i]; + const axis = this.stage.axes[role].filter((axis) => axis.tickText.length)[0]; + if (axis) { + const capabilities = this.specCapabilities.roles.filter((r) => r.role === role)[0]; + const column = this.columns[role]; + if (division >= 0 && (capabilities === null || capabilities === void 0 ? void 0 : capabilities.axisSelection)) searchRoles.push({ + axis, + role, + capabilities, + column, + division + }); + } + }); + switch (searchRoles.length) { + case 0: return null; + case 1: return this.getSearchFromSearchRole(searchRoles[0]); + default: { + const roles = searchRoles.map((searchRole) => this.getSearchFromSearchRole(searchRole)); + roles.forEach((role, i) => { + if (i === 0) return; + role.clause = "&&"; + }); + return roles; + } + } + } + getSearchFromSearchRole(searchRole) { + const getSearch = searchRole.capabilities.axisSelection === "exact" ? (a, c, i) => ({ expressions: [selectExactAxis(a, c, i)] }) : selectBetweenAxis; + const { axis, column, division } = searchRole; + return getSearch(axis, column, division); + } + }; + function moveTicksBetween(axes) { + axes.forEach((axis) => { + if (axis.ticks.length === 0) return; + const dim = roleToDim[axis.axisRole]; + const { color } = axis.ticks[0]; + const newLine = (value) => { + const line = { + sourcePosition: [ + 0, + 0, + 0 + ], + targetPosition: [ + 0, + 0, + 0 + ], + color + }; + line.sourcePosition[dim] = value; + return line; + }; + const newTicks = []; + newTicks.push(newLine(axis.domain.sourcePosition[dim])); + for (let i = 1; i < axis.ticks.length; i++) newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); + newTicks.push(newLine(axis.domain.targetPosition[dim])); + axis.ticks = newTicks; + }); + } + //#endregion + //#region ../sanddance/dist/es6/colorCubes.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function populateColorContext(colorContext, presenter) { + if (!colorContext.colorMap) colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; + colorContext.legend = clone(presenter.stage.legend); + colorContext.legendElement = presenter.getElement(PresenterElement$1.legend).children[0]; + } + //#endregion + //#region ../sanddance/dist/es6/dataScope.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var DataScope$2 = class { + constructor() { + this.filteredColumnsStats = {}; + } + setData(data, columns) { + const differentData = this.data !== data; + if (differentData) { + if (this.data) this.deselect(); + this.data = data; + this.columns = columns; + this.filteredData = null; + this.filteredColumnsStats = {}; + } + return differentData; + } + setFilteredData(filteredData) { + this.filteredData = filteredData; + this.filteredColumnsStats = {}; + } + getColumns(columnTypes) { + if (!this.columns) this.columns = getColumnsFromData(base$3.vega.inferTypes, this.data, columnTypes); + return this.columns; + } + getFilteredColumnStats(columnName) { + if (!this.filteredColumnsStats[columnName]) this.filteredColumnsStats[columnName] = getStats(this.filteredData, this.columns.filter((c) => c.name === columnName)[0]); + return this.filteredColumnsStats[columnName]; + } + currentData() { + return this.filteredData || this.data; + } + select(search) { + this.deselect(); + if (search) { + this.selection = this.createUserSelection(search, true, false); + if (this.selection.included.length) this.activate(this.selection.included[0]); + } + } + createUserSelection(search, assign, rebase) { + const exec = new Exec(search, this.getColumns()); + const s = { + search, + included: [], + excluded: [] + }; + (rebase ? this.data : this.currentData()).forEach((datum) => { + if (exec.run(datum)) { + if (assign) datum[FieldNames.Selected] = true; + s.included.push(datum); + } else s.excluded.push(datum); + }); + return s; + } + deselect() { + this.deactivate(); + this.data.forEach((datum) => { + delete datum[FieldNames.Selected]; + }); + this.selection = null; + } + hasFilteredData() { + return !!this.filteredData; + } + hasSelectedData() { + return !!this.selection; + } + collapse(collapsed, data = this.data) { + data.forEach((datum) => { + datum[FieldNames.Collapsed] = collapsed; + }); + this.isCollapsed = collapsed; + } + activate(datum) { + this.deactivate(); + datum[FieldNames.Active] = true; + this.active = datum; + } + deactivate() { + if (this.active) delete this.active[FieldNames.Active]; + this.active = null; + } + ordinalIndexWithinSelection(ordinal) { + if (this.selection) for (let i = 0; i < this.selection.included.length; i++) { + const datum = this.selection.included[i]; + if (datum["GL_ORDINAL"] === ordinal) return { + datum, + index: i + }; + } + return { + datum: null, + index: -1 + }; + } + finalize() { + this.data = null; + this.filteredData = null; + this.filteredColumnsStats = null; + if (this.selection) { + this.selection.excluded = null; + this.selection.included = null; + this.selection = null; + } + } + }; + //#endregion + //#region ../sanddance/dist/es6/details.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var Action; + (function(Action) { + Action[Action["deselect"] = 0] = "deselect"; + Action[Action["isolate"] = 1] = "isolate"; + Action[Action["exclude"] = 2] = "exclude"; + Action[Action["reset"] = 3] = "reset"; + Action[Action["next"] = 4] = "next"; + Action[Action["previous"] = 5] = "previous"; + })(Action || (Action = {})); + var Details = class { + constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps) { + this.language = language; + this.animator = animator; + this.dataScope = dataScope; + this.colorMapHandler = colorMapHandler; + this.hasColorMaps = hasColorMaps; + this.element = addDiv(parentElement, `${cssPrefix}unitControls`); + this.clear(); + } + finalize() { + if (this.element) this.element.innerHTML = ""; + this.dataScope = null; + this.element = null; + } + clear() { + this.state = { + userSelection: null, + index: -1, + remapColor: false + }; + this.render(); + } + clearSelection() { + this.state.userSelection = null; + this.state.index = -1; + this.render(); + } + populate(userSelection, index = 0) { + this.state.userSelection = userSelection; + this.state.index = index; + this.render(); + } + selectByNameValue(columnName, value) { + const search = { + name: columnName, + operator: "==", + value + }; + this.clearSelection(); + this.animator.select(search); + this.populate(this.dataScope.selection); + } + remapChanged(remap) { + this.state.remapColor = remap; + this.colorMapHandler(remap); + this.render(); + } + handleAction(action) { + let p; + const u = this.state.userSelection; + switch (action) { + case Action.deselect: + this.clearSelection(); + p = this.animator.deselect(); + break; + case Action.exclude: + this.clearSelection(); + p = this.animator.filter(invert$2(u.search), u.excluded, u.included, false); + this.state.remapColor = false; + break; + case Action.isolate: + this.clearSelection(); + p = this.animator.filter(u.search, u.included, u.excluded, false); + this.state.remapColor = false; + break; + case Action.reset: + this.clear(); + p = this.animator.reset(); + break; + default: + switch (action) { + case Action.previous: + this.state.index--; + if (this.state.index < 0) this.state.index = this.state.userSelection.included.length - 1; + break; + case Action.next: + this.state.index++; + if (this.state.index >= this.state.userSelection.included.length) this.state.index = 0; + break; + } + this.render(); + p = this.animator.activate(this.state.userSelection.included[this.state.index]); + } + p.then(() => this.render()); + } + render() { + const hasRefinedData = this.dataScope.hasFilteredData(); + const renderProps = { + language: this.language, + actionHandler: (action) => this.handleAction(action), + selectionHandler: (columnName, value) => this.selectByNameValue(columnName, value), + count: this.state.userSelection && this.state.userSelection.included.length, + hasRefinedData, + item: this.state.userSelection && this.state.userSelection.included[this.state.index], + remapColorHandler: (remap) => this.remapChanged(remap), + hasColorMaps: this.hasColorMaps() && hasRefinedData, + remapColor: this.state.remapColor + }; + const a = getActiveElementInfo(); + mount(renderDetails(renderProps), this.element); + setActiveElement(a); + } + }; + var renderDetails = (props) => { + const controlButtons = [ + createElement("button", { + disabled: !props.item, + onClick: (e) => props.actionHandler(Action.deselect) + }, props.language.deselect), + createElement("button", { + disabled: !props.item, + onClick: (e) => props.actionHandler(Action.isolate) + }, props.language.isolate), + createElement("button", { + disabled: !props.item, + onClick: (e) => props.actionHandler(Action.exclude) + }, props.language.exclude) + ]; + const colorMapping = createElement("div", null, createElement("button", { + disabled: props.remapColor, + onClick: (e) => props.remapColorHandler(true) + }, props.language.newColorMap), createElement("button", { + disabled: !props.remapColor, + onClick: (e) => props.remapColorHandler(false) + }, props.language.oldColorMap)); + const singleItem = props.count === 1; + const scrollButtons = [ + createElement("button", { + disabled: singleItem, + onClick: (e) => props.actionHandler(Action.previous) + }, props.language.previousDetail), + createElement("button", { + disabled: singleItem, + onClick: (e) => props.actionHandler(Action.next) + }, props.language.nextDetail), + createElement("span", null, " ", props.language.selectionCount(props.count)) + ]; + const rows = []; + for (const prop in props.item) { + if (prop === "GL_ORDINAL") continue; + if (isInternalFieldName(prop)) continue; + rows.push({ cells: [{ content: prop }, { content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) }] }); + } + return createElement("div", null, props.hasColorMaps && colorMapping, createElement("h4", null, props.language.headers.selection), createElement("div", { className: `${cssPrefix}selection` }, controlButtons, createElement("button", { + disabled: !props.hasRefinedData, + onClick: (e) => props.actionHandler(Action.reset) + }, "reset")), props.item && createElement("h4", null, props.language.headers.details), createElement("div", null, createElement("div", { className: `${cssPrefix}details-scroll` }, props.item && scrollButtons), createElement("div", { className: `${cssPrefix}details` }, props.item && createElement(Table$1, { rows })))); + }; + function linkSelect(language, columnName, value, selectionHandler) { + return createElement("span", null, createElement("a", { + href: "#", + onClick: (e) => selectionHandler(columnName, value) + }, value), isNaN(value) ? [" ", createElement("a", { + className: "bing-search", + href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`, + target: "_blank" + }, language.bing)] : ""); + } + //#endregion + //#region ../sanddance/dist/es6/headers.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function ensureHeaders(presenter, headers) { + const vegaControls = presenter.getElement(PresenterElement$1.vegaControls); + conditionalHeader(!!vegaControls.querySelectorAll(".vega-bindings > *").length, vegaControls, headers.chart); + const legend = presenter.getElement(PresenterElement$1.legend); + conditionalHeader(!!legend.children.length, legend, headers.legend); + } + function conditionalHeader(condition, element, header) { + const existing = existingHeader(element, header); + if (condition && !existing) addHeader(element, header); + if (!condition && existing) existing.remove(); + } + function addHeader(element, header) { + const h = document.createElement("h4"); + h.innerHTML = header; + element.insertAdjacentElement("beforebegin", h); + } + function existingHeader(element, header) { + const { previousElementSibling } = element; + if (previousElementSibling && previousElementSibling.innerHTML === header) return previousElementSibling; + } + //#endregion + //#region ../sanddance/dist/es6/legend.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function legendRange(colorBinType, column, legend, clickedIndex) { + if (column.quantitative) return selectQuantitative(colorBinType, column, legend, clickedIndex); + else return selectCategorical(column, legend, clickedIndex); + } + function selectCategorical(column, legend, clickedIndex) { + if (legend.rows[clickedIndex].value === "__Other") { + const values = []; + for (const i in legend.rows) if (+i !== clickedIndex) values.push(legend.rows[i].value); + return selectNone(column, values); + } else return { expressions: [selectExact(column, legend.rows[clickedIndex].value)] }; + } + function selectQuantitative(colorBinType, column, legend, clickedIndex) { + const keys = Object.keys(legend.rows).map((key) => +key).sort((a, b) => +a - +b); + let lowValue; + let lowOperator; + let highValue; + let highOperator; + const rowText = legend.rows[clickedIndex].label; + switch (colorBinType) { + case "continuous": + lowValue = rowText; + if (clickedIndex < keys.length - 1) highValue = legend.rows[clickedIndex + 1].value; + break; + default: { + if (rowText.indexOf("null") > 0) return { expressions: [selectNullOrEmpty(column)] }; + const dash = rowText.indexOf("–"); + if (dash > 0) { + lowValue = rowText.substr(0, dash); + highValue = rowText.substr(dash + 1); + } else if (rowText.indexOf("<") >= 0) highValue = rowText.substring(2); + else if (rowText.indexOf("≥") >= 0) lowValue = rowText.substring(2); + } + } + if (lowValue) lowValue = notNice(lowValue); + if (highValue) highValue = notNice(highValue); + if (lowValue === highValue) return { expressions: [selectExact(column, lowValue)] }; + else return selectBetween(column, lowValue, highValue, lowOperator, highOperator); + } + function finalizeLegend(colorBinType, colorColumn, legend, language) { + const rowTexts = []; + for (const i in legend.rows) { + const row = legend.rows[i]; + row.search = legendRange(colorBinType, colorColumn, legend, +i); + if (row.value === "__Other") row.label = language.legendOther; + else rowTexts.push(row.value); + } + } + //#endregion + //#region ../sanddance/dist/es6/ordinal.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function assignOrdinals(columns, data, ordinalMap) { + const uCol = columns.uid && columns.uid.name; + if (ordinalMap) data.forEach((d, i) => { + const key = uCol ? d[uCol] : i; + d[GL_ORDINAL] = ordinalMap[key]; + }); + else { + ordinalMap = {}; + data.forEach((d, i) => { + d[GL_ORDINAL] = i; + const uColValue = uCol ? d[uCol] : i; + ordinalMap[uColValue] = i; + }); + } + return ordinalMap; + } + function getDataIndexOfCube(cube, data) { + const len = data.length; + for (let i = 0; i < len; i++) if (data[i]["GL_ORDINAL"] === cube.ordinal) return i; + } + //#endregion + //#region ../sanddance/dist/es6/array.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var { allTruthy, concat, push } = util_exports$2; + //#endregion + //#region ../sanddance/dist/es6/search.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getSearchGroupFromVegaValue(search) { + let group; + const vegaSearch = search; + if (Array.isArray(vegaSearch)) { + group = { expressions: [] }; + vegaSearch.forEach((g) => { + const clonedExpressions = clone(g.expressions).filter(Boolean); + clonedExpressions[0].clause = "&&"; + push(group.expressions, clonedExpressions); + }); + } else group = vegaSearch ? { expressions: vegaSearch.expressions.filter(Boolean) } : null; + return group; + } + //#endregion + //#region ../sanddance/dist/es6/signals.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function applySignalValues(sv, b) { + if (!sv || !b || !b.signals || !b.signals.length) return; + for (const key in sv) { + const value = sv[key]; + const signalB = b.signals.filter((signal) => signal.name === key)[0]; + if (signalB && signalB.bind) signalB.value = value; + } + } + function extractSignalValuesFromView(view, spec) { + if (!view || !spec || !spec.signals || !spec.signals.length) return; + const result = {}; + spec.signals.forEach((signalA) => { + if (signalA.bind) try { + result[signalA.name] = view.signal(signalA.name); + } catch (e) {} + }); + return result; + } + var hideSignalUI = [ + SignalNames.MarkOpacity, + SignalNames.TextAngleX, + SignalNames.TextAngleY + ]; + function unbindSignalUI(spec) { + spec.signals.forEach((signal) => { + if (hideSignalUI.indexOf(signal.name) >= 0) delete signal.bind; + }); + } + //#endregion + //#region ../sanddance/dist/es6/tooltip.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var { outerSize } = util_exports$2; + var { Table } = controls_exports$1; + var Tooltip$1 = class { + constructor(props) { + this.props = props; + const renderProps = { + cssPrefix: props.cssPrefix, + rows: getRows(props.dataItem) + }; + this.finalizeHandler = () => this.destroy(); + this.element = renderTooltip(renderProps); + if (this.element) { + this.element.style.position = "absolute"; + this.child = this.element.firstChild; + document.body.appendChild(this.element); + let m = outerSize(this.child); + while (m.height > document.documentElement.clientHeight) { + const tr = this.child.querySelector("tr:last-child"); + if (tr) tr.parentElement.removeChild(tr); + else break; + m = outerSize(this.child); + } + let position; + const te = props.event; + if (te.touches) position = te[0]; + else position = props.event; + if (position.clientX + m.width >= document.documentElement.clientWidth) this.child.style.right = "0"; + let moveTop = true; + if (position.clientY + m.height >= document.documentElement.clientHeight) if (position.clientY - m.height > 0) this.child.style.bottom = "0"; + else moveTop = false; + if (moveTop) this.element.style.top = `${position.clientY}px`; + this.element.style.left = `${position.clientX}px`; + this.child.addEventListener("mouseenter", this.finalizeHandler); + this.child.addEventListener("mousemove", this.finalizeHandler); + this.child.addEventListener("mouseover", this.finalizeHandler); + } + } + destroy() { + this.child.removeEventListener("mouseenter", this.finalizeHandler); + this.child.removeEventListener("mousemove", this.finalizeHandler); + this.child.removeEventListener("mouseover", this.finalizeHandler); + if (this.element) document.body.removeChild(this.element); + this.element = null; + } + }; + function cleanDataItem(item) { + const ret = {}; + for (const columnName in item) { + if (columnName === "GL_ORDINAL") continue; + if (isInternalFieldName(columnName)) continue; + ret[columnName] = item[columnName]; + } + return ret; + } + function getRows(item) { + const rows = []; + for (const columnName in item) { + const value = item[columnName]; + let content; + switch (value) { + case null: + content = createElement("i", null, "null"); + break; + case void 0: + content = createElement("i", null, "undefined"); + break; + default: content = value.toString(); + } + rows.push({ cells: [{ content: columnName + ":" }, { content }] }); + } + return rows; + } + var renderTooltip = (props) => { + return props.rows.length === 0 ? null : createElement("div", { className: `${props.cssPrefix}tooltip` }, Table({ rows: props.rows })); + }; + //#endregion + //#region ../sanddance/dist/es6/characterSet.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var CharacterSet = class { + resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { + if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) this.chars = void 0; + } + getCharacterSet(stage) { + if (!this.chars) { + const map = {}; + const addText = (text) => { + Array.from(text).forEach((char) => { + map[char] = true; + }); + }; + stage.textData.forEach((t) => addText(t.text)); + const { x, y } = stage.axes; + [x, y].forEach((axes) => { + axes.forEach((axis) => { + if (axis.tickText) axis.tickText.forEach((t) => addText(t.text)); + if (axis.title) addText(axis.title.text); + }); + }); + this.chars = Object.keys(map); + } + return this.chars; + } + }; + function needsNewCharacterSet(oldInsight, newInsight) { + if (!oldInsight) return true; + if (!newInsight) return true; + if (oldInsight.chart !== newInsight.chart) return true; + if (oldInsight.facetStyle !== newInsight.facetStyle) return true; + if (oldInsight.totalStyle !== newInsight.totalStyle) return true; + if (oldInsight.hideAxes !== newInsight.hideAxes) return true; + if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) return true; + if (differentObjectValues(oldInsight.size, newInsight.size)) return true; + const oldColumns = oldInsight.columns; + const newColumns = newInsight.columns; + if (oldColumns.facet !== newColumns.facet) return true; + if (oldColumns.facetV !== newColumns.facetV) return true; + if (oldColumns.x !== newColumns.x) return true; + if (oldColumns.y !== newColumns.y) return true; + if (oldColumns.z !== newColumns.z) return true; + return false; + } + function differentObjectValues(a, b) { + if (!a && !b) return false; + if (!a || !b) return true; + const keys = Object.keys(b); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const ta = typeof a; + if (ta !== typeof b) return true; + if (ta === "object") return differentObjectValues(a[key], b[key]); + else if (a[key] !== b[key]) return true; + } + return false; + } + //#endregion + //#region ../../node_modules/d3-array/src/ascending.js + function ascending$2(a, b) { + return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + } + //#endregion + //#region ../../node_modules/d3-array/src/descending.js + function descending$1(a, b) { + return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; + } + //#endregion + //#region ../../node_modules/d3-array/src/bisector.js + function bisector(f) { + let compare1, compare2, delta; + if (f.length !== 2) { + compare1 = ascending$2; + compare2 = (d, x) => ascending$2(f(d), x); + delta = (d, x) => f(d) - x; + } else { + compare1 = f === ascending$2 || f === descending$1 ? f : zero$3; + compare2 = f; + delta = f; + } + function left(a, x, lo = 0, hi = a.length) { + if (lo < hi) { + if (compare1(x, x) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a[mid], x) < 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + function right(a, x, lo = 0, hi = a.length) { + if (lo < hi) { + if (compare1(x, x) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a[mid], x) <= 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + function center(a, x, lo = 0, hi = a.length) { + const i = left(a, x, lo, hi - 1); + return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; + } + return { + left, + center, + right + }; + } + function zero$3() { + return 0; + } + //#endregion + //#region ../../node_modules/d3-array/src/number.js + function number$6(x) { + return x === null ? NaN : +x; + } + function* numbers$2(values, valueof) { + if (valueof === void 0) { + for (let value of values) if (value != null && (value = +value) >= value) yield value; + } else { + let index = -1; + for (let value of values) if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) yield value; + } + } + //#endregion + //#region ../../node_modules/d3-array/src/bisect.js + var ascendingBisect = bisector(ascending$2); + var bisectRight$1 = ascendingBisect.right; + var bisectLeft$1 = ascendingBisect.left; + bisector(number$6).center; + //#endregion + //#region ../../node_modules/d3-array/src/variance.js + function variance(values, valueof) { + let count = 0; + let delta; + let mean = 0; + let sum = 0; + if (valueof === void 0) { + for (let value of values) if (value != null && (value = +value) >= value) { + delta = value - mean; + mean += delta / ++count; + sum += delta * (value - mean); + } + } else { + let index = -1; + for (let value of values) if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { + delta = value - mean; + mean += delta / ++count; + sum += delta * (value - mean); + } + } + if (count > 1) return sum / (count - 1); + } + //#endregion + //#region ../../node_modules/d3-array/src/deviation.js + function deviation(values, valueof) { + const v = variance(values, valueof); + return v ? Math.sqrt(v) : v; + } + //#endregion + //#region ../../node_modules/d3-array/src/fsum.js + var Adder = class { + constructor() { + this._partials = new Float64Array(32); + this._n = 0; + } + add(x) { + const p = this._partials; + let i = 0; + for (let j = 0; j < this._n && j < 32; j++) { + const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); + if (lo) p[i++] = lo; + x = hi; + } + p[i] = x; + this._n = i + 1; + return this; + } + valueOf() { + const p = this._partials; + let n = this._n, x, y, lo, hi = 0; + if (n > 0) { + hi = p[--n]; + while (n > 0) { + x = hi; + y = p[--n]; + hi = x + y; + lo = y - (hi - x); + if (lo) break; + } + if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { + y = lo * 2; + x = hi + y; + if (y == x - hi) hi = x; + } + } + return hi; + } + }; + //#endregion + //#region ../../node_modules/internmap/src/index.js + var InternMap = class extends Map { + constructor(entries, key = keyof) { + super(); + Object.defineProperties(this, { + _intern: { value: /* @__PURE__ */ new Map() }, + _key: { value: key } + }); + if (entries != null) for (const [key, value] of entries) this.set(key, value); + } + get(key) { + return super.get(intern_get(this, key)); + } + has(key) { + return super.has(intern_get(this, key)); + } + set(key, value) { + return super.set(intern_set(this, key), value); + } + delete(key) { + return super.delete(intern_delete(this, key)); + } + }; + var InternSet = class extends Set { + constructor(values, key = keyof) { + super(); + Object.defineProperties(this, { + _intern: { value: /* @__PURE__ */ new Map() }, + _key: { value: key } + }); + if (values != null) for (const value of values) this.add(value); + } + has(value) { + return super.has(intern_get(this, value)); + } + add(value) { + return super.add(intern_set(this, value)); + } + delete(value) { + return super.delete(intern_delete(this, value)); + } + }; + function intern_get({ _intern, _key }, value) { + const key = _key(value); + return _intern.has(key) ? _intern.get(key) : value; + } + function intern_set({ _intern, _key }, value) { + const key = _key(value); + if (_intern.has(key)) return _intern.get(key); + _intern.set(key, value); + return value; + } + function intern_delete({ _intern, _key }, value) { + const key = _key(value); + if (_intern.has(key)) { + value = _intern.get(key); + _intern.delete(key); + } + return value; + } + function keyof(value) { + return value !== null && typeof value === "object" ? value.valueOf() : value; + } + //#endregion + //#region ../../node_modules/d3-array/src/permute.js + function permute(source, keys) { + return Array.from(keys, (key) => source[key]); + } + //#endregion + //#region ../../node_modules/d3-array/src/sort.js + function compareDefined(compare = ascending$2) { + if (compare === ascending$2) return ascendingDefined; + if (typeof compare !== "function") throw new TypeError("compare is not a function"); + return (a, b) => { + const x = compare(a, b); + if (x || x === 0) return x; + return (compare(b, b) === 0) - (compare(a, a) === 0); + }; + } + function ascendingDefined(a, b) { + return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0); + } + //#endregion + //#region ../../node_modules/d3-array/src/ticks.js + var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); + function tickSpec(start, stop, count) { + const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; + let i1, i2, inc; + if (power < 0) { + inc = Math.pow(10, -power) / factor; + i1 = Math.round(start * inc); + i2 = Math.round(stop * inc); + if (i1 / inc < start) ++i1; + if (i2 / inc > stop) --i2; + inc = -inc; + } else { + inc = Math.pow(10, power) * factor; + i1 = Math.round(start / inc); + i2 = Math.round(stop / inc); + if (i1 * inc < start) ++i1; + if (i2 * inc > stop) --i2; + } + if (i2 < i1 && .5 <= count && count < 2) return tickSpec(start, stop, count * 2); + return [ + i1, + i2, + inc + ]; + } + function ticks(start, stop, count) { + stop = +stop, start = +start, count = +count; + if (!(count > 0)) return []; + if (start === stop) return [start]; + const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count); + if (!(i2 >= i1)) return []; + const n = i2 - i1 + 1, ticks = new Array(n); + if (reverse) if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc; + else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc; + else if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc; + else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc; + return ticks; + } + function tickIncrement(start, stop, count) { + stop = +stop, start = +start, count = +count; + return tickSpec(start, stop, count)[2]; + } + function tickStep(start, stop, count) { + stop = +stop, start = +start, count = +count; + const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count); + return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + } + //#endregion + //#region ../../node_modules/d3-array/src/max.js + function max$2(values, valueof) { + let max; + if (valueof === void 0) { + for (const value of values) if (value != null && (max < value || max === void 0 && value >= value)) max = value; + } else { + let index = -1; + for (let value of values) if ((value = valueof(value, ++index, values)) != null && (max < value || max === void 0 && value >= value)) max = value; + } + return max; + } + //#endregion + //#region ../../node_modules/d3-array/src/min.js + function min$2(values, valueof) { + let min; + if (valueof === void 0) { + for (const value of values) if (value != null && (min > value || min === void 0 && value >= value)) min = value; + } else { + let index = -1; + for (let value of values) if ((value = valueof(value, ++index, values)) != null && (min > value || min === void 0 && value >= value)) min = value; + } + return min; + } + //#endregion + //#region ../../node_modules/d3-array/src/quickselect.js + function quickselect(array, k, left = 0, right = Infinity, compare) { + k = Math.floor(k); + left = Math.floor(Math.max(0, left)); + right = Math.floor(Math.min(array.length - 1, right)); + if (!(left <= k && k <= right)) return array; + compare = compare === void 0 ? ascendingDefined : compareDefined(compare); + while (right > left) { + if (right - left > 600) { + const n = right - left + 1; + const m = k - left + 1; + const z = Math.log(n); + const s = .5 * Math.exp(2 * z / 3); + const sd = .5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + quickselect(array, k, newLeft, newRight, compare); + } + const t = array[k]; + let i = left; + let j = right; + swap$1(array, left, k); + if (compare(array[right], t) > 0) swap$1(array, left, right); + while (i < j) { + swap$1(array, i, j), ++i, --j; + while (compare(array[i], t) < 0) ++i; + while (compare(array[j], t) > 0) --j; + } + if (compare(array[left], t) === 0) swap$1(array, left, j); + else ++j, swap$1(array, j, right); + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; + } + return array; + } + function swap$1(array, i, j) { + const t = array[i]; + array[i] = array[j]; + array[j] = t; + } + //#endregion + //#region ../../node_modules/d3-array/src/quantile.js + function quantile$1(values, p, valueof) { + values = Float64Array.from(numbers$2(values, valueof)); + if (!(n = values.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return min$2(values); + if (p >= 1) return max$2(values); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$2(quickselect(values, i0).subarray(0, i0 + 1)); + return value0 + (min$2(values.subarray(i0 + 1)) - value0) * (i - i0); + } + function quantileSorted(values, p, valueof = number$6) { + if (!(n = values.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return +valueof(values[0], 0, values); + if (p >= 1) return +valueof(values[n - 1], n - 1, values); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values); + return value0 + (+valueof(values[i0 + 1], i0 + 1, values) - value0) * (i - i0); + } + //#endregion + //#region ../../node_modules/d3-array/src/mean.js + function mean(values, valueof) { + let count = 0; + let sum = 0; + if (valueof === void 0) { + for (let value of values) if (value != null && (value = +value) >= value) ++count, sum += value; + } else { + let index = -1; + for (let value of values) if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count, sum += value; + } + if (count) return sum / count; + } + //#endregion + //#region ../../node_modules/d3-array/src/median.js + function median(values, valueof) { + return quantile$1(values, .5, valueof); + } + //#endregion + //#region ../../node_modules/d3-array/src/merge.js + function* flatten(arrays) { + for (const array of arrays) yield* array; + } + function merge$4(arrays) { + return Array.from(flatten(arrays)); + } + //#endregion + //#region ../../node_modules/d3-array/src/range.js + function range$3(start, stop, step) { + start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; + var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); + while (++i < n) range[i] = start + i * step; + return range; + } + //#endregion + //#region ../../node_modules/d3-array/src/sum.js + function sum$1(values, valueof) { + let sum = 0; + if (valueof === void 0) { + for (let value of values) if (value = +value) sum += value; + } else { + let index = -1; + for (let value of values) if (value = +valueof(value, ++index, values)) sum += value; + } + return sum; + } + //#endregion + //#region ../../node_modules/d3-array/src/intersection.js + function intersection(values, ...others) { + values = new InternSet(values); + others = others.map(set$4); + out: for (const value of values) for (const other of others) if (!other.has(value)) { + values.delete(value); + continue out; + } + return values; + } + function set$4(values) { + return values instanceof InternSet ? values : new InternSet(values); + } + //#endregion + //#region ../../node_modules/d3-array/src/union.js + function union(...others) { + const set = new InternSet(); + for (const other of others) for (const o of other) set.add(o); + return set; + } + //#endregion + //#region ../../node_modules/d3-scale/src/init.js + function initRange(domain, range) { + switch (arguments.length) { + case 0: break; + case 1: + this.range(domain); + break; + default: + this.range(range).domain(domain); + break; + } + return this; + } + function initInterpolator(domain, interpolator) { + switch (arguments.length) { + case 0: break; + case 1: + if (typeof domain === "function") this.interpolator(domain); + else this.range(domain); + break; + default: + this.domain(domain); + if (typeof interpolator === "function") this.interpolator(interpolator); + else this.range(interpolator); + break; + } + return this; + } + //#endregion + //#region ../../node_modules/d3-scale/src/ordinal.js + var implicit = Symbol("implicit"); + function ordinal() { + var index = new InternMap(), domain = [], range = [], unknown = implicit; + function scale(d) { + let i = index.get(d); + if (i === void 0) { + if (unknown !== implicit) return unknown; + index.set(d, i = domain.push(d) - 1); + } + return range[i % range.length]; + } + scale.domain = function(_) { + if (!arguments.length) return domain.slice(); + domain = [], index = new InternMap(); + for (const value of _) { + if (index.has(value)) continue; + index.set(value, domain.push(value) - 1); + } + return scale; + }; + scale.range = function(_) { + return arguments.length ? (range = Array.from(_), scale) : range.slice(); + }; + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + scale.copy = function() { + return ordinal(domain, range).unknown(unknown); + }; + initRange.apply(scale, arguments); + return scale; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/basis.js + function basis(t1, v0, v1, v2, v3) { + var t2 = t1 * t1, t3 = t2 * t1; + return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; + } + function basis_default$1(values) { + var n = values.length - 1; + return function(t) { + var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; + return basis((t - i / n) * n, v0, v1, v2, v3); + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/basisClosed.js + function basisClosed_default$1(values) { + var n = values.length; + return function(t) { + var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; + return basis((t - i / n) * n, v0, v1, v2, v3); + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/constant.js + var constant_default$3 = (x) => () => x; + //#endregion + //#region ../../node_modules/d3-interpolate/src/color.js + function linear$2(a, d) { + return function(t) { + return a + t * d; + }; + } + function exponential(a, b, y) { + return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { + return Math.pow(a + t * b, y); + }; + } + function hue(a, b) { + var d = b - a; + return d ? linear$2(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant_default$3(isNaN(a) ? b : a); + } + function gamma(y) { + return (y = +y) === 1 ? nogamma : function(a, b) { + return b - a ? exponential(a, b, y) : constant_default$3(isNaN(a) ? b : a); + }; + } + function nogamma(a, b) { + var d = b - a; + return d ? linear$2(a, d) : constant_default$3(isNaN(a) ? b : a); + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/rgb.js + var rgb_default = (function rgbGamma(y) { + var color = gamma(y); + function rgb$1(start, end) { + var r = color((start = rgb(start)).r, (end = rgb(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; + } + rgb$1.gamma = rgbGamma; + return rgb$1; + })(1); + function rgbSpline(spline) { + return function(colors) { + var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; + for (i = 0; i < n; ++i) { + color = rgb(colors[i]); + r[i] = color.r || 0; + g[i] = color.g || 0; + b[i] = color.b || 0; + } + r = spline(r); + g = spline(g); + b = spline(b); + color.opacity = 1; + return function(t) { + color.r = r(t); + color.g = g(t); + color.b = b(t); + return color + ""; + }; + }; + } + var rgbBasis = rgbSpline(basis_default$1); + var rgbBasisClosed = rgbSpline(basisClosed_default$1); + //#endregion + //#region ../../node_modules/d3-interpolate/src/numberArray.js + function numberArray_default(a, b) { + if (!b) b = []; + var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; + return function(t) { + for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; + return c; + }; + } + function isNumberArray(x) { + return ArrayBuffer.isView(x) && !(x instanceof DataView); + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/array.js + function array_default$2(a, b) { + return (isNumberArray(b) ? numberArray_default : genericArray)(a, b); + } + function genericArray(a, b) { + var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; + for (i = 0; i < na; ++i) x[i] = value_default(a[i], b[i]); + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < na; ++i) c[i] = x[i](t); + return c; + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/date.js + function date_default(a, b) { + var d = /* @__PURE__ */ new Date(); + return a = +a, b = +b, function(t) { + return d.setTime(a * (1 - t) + b * t), d; + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/number.js + function number_default(a, b) { + return a = +a, b = +b, function(t) { + return a * (1 - t) + b * t; + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/object.js + function object_default(a, b) { + var i = {}, c = {}, k; + if (a === null || typeof a !== "object") a = {}; + if (b === null || typeof b !== "object") b = {}; + for (k in b) if (k in a) i[k] = value_default(a[k], b[k]); + else c[k] = b[k]; + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/string.js + var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); + function zero$2(b) { + return function() { + return b; + }; + } + function one$2(b) { + return function(t) { + return b(t) + ""; + }; + } + function string_default(a, b) { + var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; + a = a + "", b = b + ""; + while ((am = reA.exec(a)) && (bm = reB.exec(b))) { + if ((bs = bm.index) > bi) { + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; + else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) if (s[i]) s[i] += bm; + else s[++i] = bm; + else { + s[++i] = null; + q.push({ + i, + x: number_default(am, bm) + }); + } + bi = reB.lastIndex; + } + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; + else s[++i] = bs; + } + return s.length < 2 ? q[0] ? one$2(q[0].x) : zero$2(b) : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/value.js + function value_default(a, b) { + var t = typeof b, c; + return b == null || t === "boolean" ? constant_default$3(b) : (t === "number" ? number_default : t === "string" ? (c = color$2(b)) ? (b = c, rgb_default) : string_default : b instanceof color$2 ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object_default : number_default)(a, b); + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/discrete.js + function discrete_default(range) { + var n = range.length; + return function(t) { + return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/hue.js + function hue_default(a, b) { + var i = hue(+a, +b); + return function(t) { + var x = i(t); + return x - 360 * Math.floor(x / 360); + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/round.js + function round_default$1(a, b) { + return a = +a, b = +b, function(t) { + return Math.round(a * (1 - t) + b * t); + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/transform/decompose.js + var degrees$2 = 180 / Math.PI; + var identity$3 = { + translateX: 0, + translateY: 0, + rotate: 0, + skewX: 0, + scaleX: 1, + scaleY: 1 + }; + function decompose_default(a, b, c, d, e, f) { + var scaleX, scaleY, skewX; + if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; + if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; + if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; + if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e, + translateY: f, + rotate: Math.atan2(b, a) * degrees$2, + skewX: Math.atan(skewX) * degrees$2, + scaleX, + scaleY + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/transform/parse.js + var svgNode; + function parseCss(value) { + const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + ""); + return m.isIdentity ? identity$3 : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f); + } + function parseSvg(value) { + if (value == null) return identity$3; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value); + if (!(value = svgNode.transform.baseVal.consolidate())) return identity$3; + value = value.matrix; + return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f); + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/transform/index.js + function interpolateTransform(parse, pxComma, pxParen, degParen) { + function pop(s) { + return s.length ? s.pop() + " " : ""; + } + function translate(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push("translate(", null, pxComma, null, pxParen); + q.push({ + i: i - 4, + x: number_default(xa, xb) + }, { + i: i - 2, + x: number_default(ya, yb) + }); + } else if (xb || yb) s.push("translate(" + xb + pxComma + yb + pxParen); + } + function rotate(a, b, s, q) { + if (a !== b) { + if (a - b > 180) b += 360; + else if (b - a > 180) a += 360; + q.push({ + i: s.push(pop(s) + "rotate(", null, degParen) - 2, + x: number_default(a, b) + }); + } else if (b) s.push(pop(s) + "rotate(" + b + degParen); + } + function skewX(a, b, s, q) { + if (a !== b) q.push({ + i: s.push(pop(s) + "skewX(", null, degParen) - 2, + x: number_default(a, b) + }); + else if (b) s.push(pop(s) + "skewX(" + b + degParen); + } + function scale(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push(pop(s) + "scale(", null, ",", null, ")"); + q.push({ + i: i - 4, + x: number_default(xa, xb) + }, { + i: i - 2, + x: number_default(ya, yb) + }); + } else if (xb !== 1 || yb !== 1) s.push(pop(s) + "scale(" + xb + "," + yb + ")"); + } + return function(a, b) { + var s = [], q = []; + a = parse(a), b = parse(b); + translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); + rotate(a.rotate, b.rotate, s, q); + skewX(a.skewX, b.skewX, s, q); + scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); + a = b = null; + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; + } + var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); + var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + //#endregion + //#region ../../node_modules/d3-interpolate/src/zoom.js + var epsilon2$1 = 1e-12; + function cosh(x) { + return ((x = Math.exp(x)) + 1 / x) / 2; + } + function sinh(x) { + return ((x = Math.exp(x)) - 1 / x) / 2; + } + function tanh(x) { + return ((x = Math.exp(2 * x)) - 1) / (x + 1); + } + var zoom_default = (function zoomRho(rho, rho2, rho4) { + function zoom(p0, p1) { + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < epsilon2$1) { + S = Math.log(w1 / w0) / rho; + i = function(t) { + return [ + ux0 + t * dx, + uy0 + t * dy, + w0 * Math.exp(rho * t * S) + ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0); + S = (Math.log(Math.sqrt(b1 * b1 + 1) - b1) - r0) / rho; + i = function(t) { + var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); + return [ + ux0 + u * dx, + uy0 + u * dy, + w0 * coshr0 / cosh(rho * s + r0) + ]; + }; + } + i.duration = S * 1e3 * rho / Math.SQRT2; + return i; + } + zoom.rho = function(_) { + var _1 = Math.max(.001, +_), _2 = _1 * _1; + return zoomRho(_1, _2, _2 * _2); + }; + return zoom; + })(Math.SQRT2, 2, 4); + //#endregion + //#region ../../node_modules/d3-interpolate/src/hsl.js + function hsl(hue) { + return function(start, end) { + var h = hue((start = hsl$1(start)).h, (end = hsl$1(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.s = s(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; + }; + } + var hsl_default = hsl(hue); + var hslLong = hsl(nogamma); + //#endregion + //#region ../../node_modules/d3-interpolate/src/lab.js + function lab(start, end) { + var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l), a = nogamma(start.a, end.a), b = nogamma(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.l = l(t); + start.a = a(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/hcl.js + function hcl(hue) { + return function(start, end) { + var h = hue((start = hcl$1(start)).h, (end = hcl$1(end)).h), c = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.c = c(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; + }; + } + var hcl_default = hcl(hue); + var hclLong = hcl(nogamma); + //#endregion + //#region ../../node_modules/d3-interpolate/src/cubehelix.js + function cubehelix(hue) { + return (function cubehelixGamma(y) { + y = +y; + function cubehelix(start, end) { + var h = hue((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.s = s(t); + start.l = l(Math.pow(t, y)); + start.opacity = opacity(t); + return start + ""; + }; + } + cubehelix.gamma = cubehelixGamma; + return cubehelix; + })(1); + } + var cubehelix_default = cubehelix(hue); + var cubehelixLong = cubehelix(nogamma); + //#endregion + //#region ../../node_modules/d3-interpolate/src/piecewise.js + function piecewise(interpolate, values) { + if (values === void 0) values = interpolate, interpolate = value_default; + var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); + while (i < n) I[i] = interpolate(v, v = values[++i]); + return function(t) { + var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); + return I[i](t - i); + }; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/quantize.js + function quantize_default(interpolator, n) { + var samples = new Array(n); + for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + return samples; + } + //#endregion + //#region ../../node_modules/d3-interpolate/src/index.js + var src_exports = /* @__PURE__ */ __exportAll({ + interpolate: () => value_default, + interpolateArray: () => array_default$2, + interpolateBasis: () => basis_default$1, + interpolateBasisClosed: () => basisClosed_default$1, + interpolateCubehelix: () => cubehelix_default, + interpolateCubehelixLong: () => cubehelixLong, + interpolateDate: () => date_default, + interpolateDiscrete: () => discrete_default, + interpolateHcl: () => hcl_default, + interpolateHclLong: () => hclLong, + interpolateHsl: () => hsl_default, + interpolateHslLong: () => hslLong, + interpolateHue: () => hue_default, + interpolateLab: () => lab, + interpolateNumber: () => number_default, + interpolateNumberArray: () => numberArray_default, + interpolateObject: () => object_default, + interpolateRgb: () => rgb_default, + interpolateRgbBasis: () => rgbBasis, + interpolateRgbBasisClosed: () => rgbBasisClosed, + interpolateRound: () => round_default$1, + interpolateString: () => string_default, + interpolateTransformCss: () => interpolateTransformCss, + interpolateTransformSvg: () => interpolateTransformSvg, + interpolateZoom: () => zoom_default, + piecewise: () => piecewise, + quantize: () => quantize_default + }); + //#endregion + //#region ../../node_modules/d3-scale/src/constant.js + function constants(x) { + return function() { + return x; + }; + } + //#endregion + //#region ../../node_modules/d3-scale/src/number.js + function number$5(x) { + return +x; + } + //#endregion + //#region ../../node_modules/d3-scale/src/continuous.js + var unit = [0, 1]; + function identity$2(x) { + return x; + } + function normalize$2(a, b) { + return (b -= a = +a) ? function(x) { + return (x - a) / b; + } : constants(isNaN(b) ? NaN : .5); + } + function clamper(a, b) { + var t; + if (a > b) t = a, a = b, b = t; + return function(x) { + return Math.max(a, Math.min(b, x)); + }; + } + function bimap(domain, range, interpolate) { + var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; + if (d1 < d0) d0 = normalize$2(d1, d0), r0 = interpolate(r1, r0); + else d0 = normalize$2(d0, d1), r0 = interpolate(r0, r1); + return function(x) { + return r0(d0(x)); + }; + } + function polymap(domain, range, interpolate) { + var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1; + if (domain[j] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + while (++i < j) { + d[i] = normalize$2(domain[i], domain[i + 1]); + r[i] = interpolate(range[i], range[i + 1]); + } + return function(x) { + var i = bisectRight$1(domain, x, 1, j) - 1; + return r[i](d[i](x)); + }; + } + function copy$2(source, target) { + return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); + } + function transformer$3() { + var domain = unit, range = unit, interpolate = value_default, transform, untransform, unknown, clamp = identity$2, piecewise, output, input; + function rescale() { + var n = Math.min(domain.length, range.length); + if (clamp !== identity$2) clamp = clamper(domain[0], domain[n - 1]); + piecewise = n > 2 ? polymap : bimap; + output = input = null; + return scale; + } + function scale(x) { + return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); + } + scale.invert = function(y) { + return clamp(untransform((input || (input = piecewise(range, domain.map(transform), number_default)))(y))); + }; + scale.domain = function(_) { + return arguments.length ? (domain = Array.from(_, number$5), rescale()) : domain.slice(); + }; + scale.range = function(_) { + return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); + }; + scale.rangeRound = function(_) { + return range = Array.from(_), interpolate = round_default$1, rescale(); + }; + scale.clamp = function(_) { + return arguments.length ? (clamp = _ ? true : identity$2, rescale()) : clamp !== identity$2; + }; + scale.interpolate = function(_) { + return arguments.length ? (interpolate = _, rescale()) : interpolate; + }; + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + return function(t, u) { + transform = t, untransform = u; + return rescale(); + }; + } + function continuous$1() { + return transformer$3()(identity$2, identity$2); + } + //#endregion + //#region ../../node_modules/d3-format/src/formatDecimal.js + function formatDecimal_default$1(x) { + return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); + } + function formatDecimalParts$1(x, p) { + if (!isFinite(x) || x === 0) return null; + var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i); + return [coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1)]; + } + //#endregion + //#region ../../node_modules/d3-format/src/exponent.js + function exponent_default$1(x) { + return x = formatDecimalParts$1(Math.abs(x)), x ? x[1] : NaN; + } + //#endregion + //#region ../../node_modules/d3-format/src/formatGroup.js + function formatGroup_default$1(grouping, thousands) { + return function(value, width) { + var i = value.length, t = [], j = 0, g = grouping[0], length = 0; + while (i > 0 && g > 0) { + if (length + g + 1 > width) g = Math.max(1, width - length); + t.push(value.substring(i -= g, i + g)); + if ((length += g + 1) > width) break; + g = grouping[j = (j + 1) % grouping.length]; + } + return t.reverse().join(thousands); + }; + } + //#endregion + //#region ../../node_modules/d3-format/src/formatNumerals.js + function formatNumerals_default$1(numerals) { + return function(value) { + return value.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } + //#endregion + //#region ../../node_modules/d3-format/src/formatSpecifier.js + var re$1 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + function formatSpecifier$1(specifier) { + if (!(match = re$1.exec(specifier))) throw new Error("invalid format: " + specifier); + var match; + return new FormatSpecifier$1({ + fill: match[1], + align: match[2], + sign: match[3], + symbol: match[4], + zero: match[5], + width: match[6], + comma: match[7], + precision: match[8] && match[8].slice(1), + trim: match[9], + type: match[10] + }); + } + formatSpecifier$1.prototype = FormatSpecifier$1.prototype; + function FormatSpecifier$1(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; + this.zero = !!specifier.zero; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; + this.comma = !!specifier.comma; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; + this.trim = !!specifier.trim; + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + FormatSpecifier$1.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + //#endregion + //#region ../../node_modules/d3-format/src/formatTrim.js + function formatTrim_default$1(s) { + out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) switch (s[i]) { + case ".": + i0 = i1 = i; + break; + case "0": + if (i0 === 0) i0 = i; + i1 = i; + break; + default: + if (!+s[i]) break out; + if (i0 > 0) i0 = 0; + break; + } + return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; + } + //#endregion + //#region ../../node_modules/d3-format/src/formatPrefixAuto.js + var prefixExponent$1; + function formatPrefixAuto_default$1(x, p) { + var d = formatDecimalParts$1(x, p); + if (!d) return prefixExponent$1 = void 0, x.toPrecision(p); + var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent$1 = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; + return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts$1(x, Math.max(0, p + i - 1))[0]; + } + //#endregion + //#region ../../node_modules/d3-format/src/formatRounded.js + function formatRounded_default$1(x, p) { + var d = formatDecimalParts$1(x, p); + if (!d) return x + ""; + var coefficient = d[0], exponent = d[1]; + return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); + } + //#endregion + //#region ../../node_modules/d3-format/src/formatTypes.js + var formatTypes_default$1 = { + "%": (x, p) => (x * 100).toFixed(p), + "b": (x) => Math.round(x).toString(2), + "c": (x) => x + "", + "d": formatDecimal_default$1, + "e": (x, p) => x.toExponential(p), + "f": (x, p) => x.toFixed(p), + "g": (x, p) => x.toPrecision(p), + "o": (x) => Math.round(x).toString(8), + "p": (x, p) => formatRounded_default$1(x * 100, p), + "r": formatRounded_default$1, + "s": formatPrefixAuto_default$1, + "X": (x) => Math.round(x).toString(16).toUpperCase(), + "x": (x) => Math.round(x).toString(16) + }; + //#endregion + //#region ../../node_modules/d3-format/src/identity.js + function identity_default$4(x) { + return x; + } + //#endregion + //#region ../../node_modules/d3-format/src/locale.js + var map$3 = Array.prototype.map, prefixes$1 = [ + "y", + "z", + "a", + "f", + "p", + "n", + "µ", + "m", + "", + "k", + "M", + "G", + "T", + "P", + "E", + "Z", + "Y" + ]; + function locale_default$1(locale) { + var group = locale.grouping === void 0 || locale.thousands === void 0 ? identity_default$4 : formatGroup_default$1(map$3.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === void 0 ? "" : locale.currency[0] + "", currencySuffix = locale.currency === void 0 ? "" : locale.currency[1] + "", decimal = locale.decimal === void 0 ? "." : locale.decimal + "", numerals = locale.numerals === void 0 ? identity_default$4 : formatNumerals_default$1(map$3.call(locale.numerals, String)), percent = locale.percent === void 0 ? "%" : locale.percent + "", minus = locale.minus === void 0 ? "−" : locale.minus + "", nan = locale.nan === void 0 ? "NaN" : locale.nan + ""; + function newFormat(specifier, options) { + specifier = formatSpecifier$1(specifier); + var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; + if (type === "n") comma = true, type = "g"; + else if (!formatTypes_default$1[type]) precision === void 0 && (precision = 12), trim = true, type = "g"; + if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; + var prefix = (options && options.prefix !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== void 0 ? options.suffix : ""); + var formatType = formatTypes_default$1[type], maybeSuffix = /[defgprs%]/.test(type); + precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format(value) { + var valuePrefix = prefix, valueSuffix = suffix, i, n, c; + if (type === "c") { + valueSuffix = formatType(value) + valueSuffix; + value = ""; + } else { + value = +value; + var valueNegative = value < 0 || 1 / value < 0; + value = isNaN(value) ? nan : formatType(Math.abs(value), precision); + if (trim) value = formatTrim_default$1(value); + if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; + valueSuffix = (type === "s" && !isNaN(value) && prefixExponent$1 !== void 0 ? prefixes$1[8 + prefixExponent$1 / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); + if (maybeSuffix) { + i = -1, n = value.length; + while (++i < n) if (c = value.charCodeAt(i), 48 > c || c > 57) { + valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; + value = value.slice(0, i); + break; + } + } + } + if (comma && !zero) value = group(value, Infinity); + var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; + if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; + switch (align) { + case "<": + value = valuePrefix + value + valueSuffix + padding; + break; + case "=": + value = valuePrefix + padding + value + valueSuffix; + break; + case "^": + value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); + break; + default: + value = padding + valuePrefix + value + valueSuffix; + break; + } + return numerals(value); + } + format.toString = function() { + return specifier + ""; + }; + return format; + } + function formatPrefix(specifier, value) { + var e = Math.max(-8, Math.min(8, Math.floor(exponent_default$1(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier$1(specifier), specifier.type = "f", specifier), { suffix: prefixes$1[8 + e / 3] }); + return function(value) { + return f(k * value); + }; + } + return { + format: newFormat, + formatPrefix + }; + } + //#endregion + //#region ../../node_modules/d3-format/src/defaultLocale.js + var locale$3; + var format$4; + var formatPrefix$1; + defaultLocale$3({ + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); + function defaultLocale$3(definition) { + locale$3 = locale_default$1(definition); + format$4 = locale$3.format; + formatPrefix$1 = locale$3.formatPrefix; + return locale$3; + } + //#endregion + //#region ../../node_modules/d3-format/src/precisionFixed.js + function precisionFixed_default(step) { + return Math.max(0, -exponent_default$1(Math.abs(step))); + } + //#endregion + //#region ../../node_modules/d3-format/src/precisionPrefix.js + function precisionPrefix_default(step, value) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default$1(value) / 3))) * 3 - exponent_default$1(Math.abs(step))); + } + //#endregion + //#region ../../node_modules/d3-format/src/precisionRound.js + function precisionRound_default(step, max) { + step = Math.abs(step), max = Math.abs(max) - step; + return Math.max(0, exponent_default$1(max) - exponent_default$1(step)) + 1; + } + //#endregion + //#region ../../node_modules/d3-scale/src/tickFormat.js + function tickFormat$1(start, stop, count, specifier) { + var step = tickStep(start, stop, count), precision; + specifier = formatSpecifier$1(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": + var value = Math.max(Math.abs(start), Math.abs(stop)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix_default(step, value))) specifier.precision = precision; + return formatPrefix$1(specifier, value); + case "": + case "e": + case "g": + case "p": + case "r": + if (specifier.precision == null && !isNaN(precision = precisionRound_default(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); + break; + case "f": + case "%": + if (specifier.precision == null && !isNaN(precision = precisionFixed_default(step))) specifier.precision = precision - (specifier.type === "%") * 2; + break; + } + return format$4(specifier); + } + //#endregion + //#region ../../node_modules/d3-scale/src/linear.js + function linearish(scale) { + var domain = scale.domain; + scale.ticks = function(count) { + var d = domain(); + return ticks(d[0], d[d.length - 1], count == null ? 10 : count); + }; + scale.tickFormat = function(count, specifier) { + var d = domain(); + return tickFormat$1(d[0], d[d.length - 1], count == null ? 10 : count, specifier); + }; + scale.nice = function(count) { + if (count == null) count = 10; + var d = domain(); + var i0 = 0; + var i1 = d.length - 1; + var start = d[i0]; + var stop = d[i1]; + var prestep; + var step; + var maxIter = 10; + if (stop < start) { + step = start, start = stop, stop = step; + step = i0, i0 = i1, i1 = step; + } + while (maxIter-- > 0) { + step = tickIncrement(start, stop, count); + if (step === prestep) { + d[i0] = start; + d[i1] = stop; + return domain(d); + } else if (step > 0) { + start = Math.floor(start / step) * step; + stop = Math.ceil(stop / step) * step; + } else if (step < 0) { + start = Math.ceil(start * step) / step; + stop = Math.floor(stop * step) / step; + } else break; + prestep = step; + } + return scale; + }; + return scale; + } + function linear$1() { + var scale = continuous$1(); + scale.copy = function() { + return copy$2(scale, linear$1()); + }; + initRange.apply(scale, arguments); + return linearish(scale); + } + //#endregion + //#region ../../node_modules/d3-scale/src/identity.js + function identity$1(domain) { + var unknown; + function scale(x) { + return x == null || isNaN(x = +x) ? unknown : x; + } + scale.invert = scale; + scale.domain = scale.range = function(_) { + return arguments.length ? (domain = Array.from(_, number$5), scale) : domain.slice(); + }; + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + scale.copy = function() { + return identity$1(domain).unknown(unknown); + }; + domain = arguments.length ? Array.from(domain, number$5) : [0, 1]; + return linearish(scale); + } + //#endregion + //#region ../../node_modules/d3-scale/src/nice.js + function nice(domain, interval) { + domain = domain.slice(); + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; + if (x1 < x0) { + t = i0, i0 = i1, i1 = t; + t = x0, x0 = x1, x1 = t; + } + domain[i0] = interval.floor(x0); + domain[i1] = interval.ceil(x1); + return domain; + } + //#endregion + //#region ../../node_modules/d3-scale/src/log.js + function transformLog(x) { + return Math.log(x); + } + function transformExp(x) { + return Math.exp(x); + } + function transformLogn(x) { + return -Math.log(-x); + } + function transformExpn(x) { + return -Math.exp(-x); + } + function pow10(x) { + return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; + } + function powp(base) { + return base === 10 ? pow10 : base === Math.E ? Math.exp : (x) => Math.pow(base, x); + } + function logp(base) { + return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x) => Math.log(x) / base); + } + function reflect(f) { + return (x, k) => -f(-x, k); + } + function loggish(transform) { + const scale = transform(transformLog, transformExp); + const domain = scale.domain; + let base = 10; + let logs; + let pows; + function rescale() { + logs = logp(base), pows = powp(base); + if (domain()[0] < 0) { + logs = reflect(logs), pows = reflect(pows); + transform(transformLogn, transformExpn); + } else transform(transformLog, transformExp); + return scale; + } + scale.base = function(_) { + return arguments.length ? (base = +_, rescale()) : base; + }; + scale.domain = function(_) { + return arguments.length ? (domain(_), rescale()) : domain(); + }; + scale.ticks = (count) => { + const d = domain(); + let u = d[0]; + let v = d[d.length - 1]; + const r = v < u; + if (r) [u, v] = [v, u]; + let i = logs(u); + let j = logs(v); + let k; + let t; + const n = count == null ? 10 : +count; + let z = []; + if (!(base % 1) && j - i < n) { + i = Math.floor(i), j = Math.ceil(j); + if (u > 0) for (; i <= j; ++i) for (k = 1; k < base; ++k) { + t = i < 0 ? k / pows(-i) : k * pows(i); + if (t < u) continue; + if (t > v) break; + z.push(t); + } + else for (; i <= j; ++i) for (k = base - 1; k >= 1; --k) { + t = i > 0 ? k / pows(-i) : k * pows(i); + if (t < u) continue; + if (t > v) break; + z.push(t); + } + if (z.length * 2 < n) z = ticks(u, v, n); + } else z = ticks(i, j, Math.min(j - i, n)).map(pows); + return r ? z.reverse() : z; + }; + scale.tickFormat = (count, specifier) => { + if (count == null) count = 10; + if (specifier == null) specifier = base === 10 ? "s" : ","; + if (typeof specifier !== "function") { + if (!(base % 1) && (specifier = formatSpecifier$1(specifier)).precision == null) specifier.trim = true; + specifier = format$4(specifier); + } + if (count === Infinity) return specifier; + const k = Math.max(1, base * count / scale.ticks().length); + return (d) => { + let i = d / pows(Math.round(logs(d))); + if (i * base < base - .5) i *= base; + return i <= k ? specifier(d) : ""; + }; + }; + scale.nice = () => { + return domain(nice(domain(), { + floor: (x) => pows(Math.floor(logs(x))), + ceil: (x) => pows(Math.ceil(logs(x))) + })); + }; + return scale; + } + function log$4() { + const scale = loggish(transformer$3()).domain([1, 10]); + scale.copy = () => copy$2(scale, log$4()).base(scale.base()); + initRange.apply(scale, arguments); + return scale; + } + //#endregion + //#region ../../node_modules/d3-scale/src/symlog.js + function transformSymlog(c) { + return function(x) { + return Math.sign(x) * Math.log1p(Math.abs(x / c)); + }; + } + function transformSymexp(c) { + return function(x) { + return Math.sign(x) * Math.expm1(Math.abs(x)) * c; + }; + } + function symlogish(transform) { + var c = 1, scale = transform(transformSymlog(c), transformSymexp(c)); + scale.constant = function(_) { + return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; + }; + return linearish(scale); + } + function symlog$1() { + var scale = symlogish(transformer$3()); + scale.copy = function() { + return copy$2(scale, symlog$1()).constant(scale.constant()); + }; + return initRange.apply(scale, arguments); + } + //#endregion + //#region ../../node_modules/d3-scale/src/pow.js + function transformPow(exponent) { + return function(x) { + return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); + }; + } + function transformSqrt(x) { + return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x); + } + function transformSquare(x) { + return x < 0 ? -x * x : x * x; + } + function powish(transform) { + var scale = transform(identity$2, identity$2), exponent = 1; + function rescale() { + return exponent === 1 ? transform(identity$2, identity$2) : exponent === .5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); + } + scale.exponent = function(_) { + return arguments.length ? (exponent = +_, rescale()) : exponent; + }; + return linearish(scale); + } + function pow$4() { + var scale = powish(transformer$3()); + scale.copy = function() { + return copy$2(scale, pow$4()).exponent(scale.exponent()); + }; + initRange.apply(scale, arguments); + return scale; + } + function sqrt$3() { + return pow$4.apply(null, arguments).exponent(.5); + } + //#endregion + //#region ../../node_modules/d3-scale/src/quantile.js + function quantile() { + var domain = [], range = [], thresholds = [], unknown; + function rescale() { + var i = 0, n = Math.max(1, range.length); + thresholds = new Array(n - 1); + while (++i < n) thresholds[i - 1] = quantileSorted(domain, i / n); + return scale; + } + function scale(x) { + return x == null || isNaN(x = +x) ? unknown : range[bisectRight$1(thresholds, x)]; + } + scale.invertExtent = function(y) { + var i = range.indexOf(y); + return i < 0 ? [NaN, NaN] : [i > 0 ? thresholds[i - 1] : domain[0], i < thresholds.length ? thresholds[i] : domain[domain.length - 1]]; + }; + scale.domain = function(_) { + if (!arguments.length) return domain.slice(); + domain = []; + for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d); + domain.sort(ascending$2); + return rescale(); + }; + scale.range = function(_) { + return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); + }; + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + scale.quantiles = function() { + return thresholds.slice(); + }; + scale.copy = function() { + return quantile().domain(domain).range(range).unknown(unknown); + }; + return initRange.apply(scale, arguments); + } + //#endregion + //#region ../../node_modules/d3-scale/src/quantize.js + function quantize$1() { + var x0 = 0, x1 = 1, n = 1, domain = [.5], range = [0, 1], unknown; + function scale(x) { + return x != null && x <= x ? range[bisectRight$1(domain, x, 0, n)] : unknown; + } + function rescale() { + var i = -1; + domain = new Array(n); + while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); + return scale; + } + scale.domain = function(_) { + return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1]; + }; + scale.range = function(_) { + return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); + }; + scale.invertExtent = function(y) { + var i = range.indexOf(y); + return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >= n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; + }; + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : scale; + }; + scale.thresholds = function() { + return domain.slice(); + }; + scale.copy = function() { + return quantize$1().domain([x0, x1]).range(range).unknown(unknown); + }; + return initRange.apply(linearish(scale), arguments); + } + //#endregion + //#region ../../node_modules/d3-scale/src/threshold.js + function threshold() { + var domain = [.5], range = [0, 1], unknown, n = 1; + function scale(x) { + return x != null && x <= x ? range[bisectRight$1(domain, x, 0, n)] : unknown; + } + scale.domain = function(_) { + return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); + }; + scale.range = function(_) { + return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); + }; + scale.invertExtent = function(y) { + var i = range.indexOf(y); + return [domain[i - 1], domain[i]]; + }; + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + scale.copy = function() { + return threshold().domain(domain).range(range).unknown(unknown); + }; + return initRange.apply(scale, arguments); + } + //#endregion + //#region ../../node_modules/d3-time/src/interval.js + var t0$1 = /* @__PURE__ */ new Date(), t1 = /* @__PURE__ */ new Date(); + function timeInterval$1(floori, offseti, count, field) { + function interval(date) { + return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date; + } + interval.floor = (date) => { + return floori(date = /* @__PURE__ */ new Date(+date)), date; + }; + interval.ceil = (date) => { + return floori(date = /* @__PURE__ */ new Date(date - 1)), offseti(date, 1), floori(date), date; + }; + interval.round = (date) => { + const d0 = interval(date), d1 = interval.ceil(date); + return date - d0 < d1 - date ? d0 : d1; + }; + interval.offset = (date, step) => { + return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date; + }; + interval.range = (start, stop, step) => { + const range = []; + start = interval.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop) || !(step > 0)) return range; + let previous; + do + range.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start); + while (previous < start && start < stop); + return range; + }; + interval.filter = (test) => { + return timeInterval$1((date) => { + if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); + }, (date, step) => { + if (date >= date) if (step < 0) while (++step <= 0) while (offseti(date, -1), !test(date)); + else while (--step >= 0) while (offseti(date, 1), !test(date)); + }); + }; + if (count) { + interval.count = (start, end) => { + t0$1.setTime(+start), t1.setTime(+end); + floori(t0$1), floori(t1); + return Math.floor(count(t0$1, t1)); + }; + interval.every = (step) => { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d) => field(d) % step === 0 : (d) => interval.count(0, d) % step === 0); + }; + } + return interval; + } + //#endregion + //#region ../../node_modules/d3-time/src/millisecond.js + var millisecond = timeInterval$1(() => {}, (date, step) => { + date.setTime(+date + step); + }, (start, end) => { + return end - start; + }); + millisecond.every = (k) => { + k = Math.floor(k); + if (!isFinite(k) || !(k > 0)) return null; + if (!(k > 1)) return millisecond; + return timeInterval$1((date) => { + date.setTime(Math.floor(date / k) * k); + }, (date, step) => { + date.setTime(+date + step * k); + }, (start, end) => { + return (end - start) / k; + }); + }; + millisecond.range; + //#endregion + //#region ../../node_modules/d3-time/src/duration.js + var durationSecond$1 = 1e3; + var durationMinute$1 = durationSecond$1 * 60; + var durationHour$1 = durationMinute$1 * 60; + var durationDay$1 = durationHour$1 * 24; + var durationWeek$1 = durationDay$1 * 7; + var durationMonth$1 = durationDay$1 * 30; + var durationYear$1 = durationDay$1 * 365; + //#endregion + //#region ../../node_modules/d3-time/src/second.js + var second = timeInterval$1((date) => { + date.setTime(date - date.getMilliseconds()); + }, (date, step) => { + date.setTime(+date + step * durationSecond$1); + }, (start, end) => { + return (end - start) / durationSecond$1; + }, (date) => { + return date.getUTCSeconds(); + }); + second.range; + //#endregion + //#region ../../node_modules/d3-time/src/minute.js + var timeMinute = timeInterval$1((date) => { + date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond$1); + }, (date, step) => { + date.setTime(+date + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date) => { + return date.getMinutes(); + }); + timeMinute.range; + var utcMinute = timeInterval$1((date) => { + date.setUTCSeconds(0, 0); + }, (date, step) => { + date.setTime(+date + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date) => { + return date.getUTCMinutes(); + }); + utcMinute.range; + //#endregion + //#region ../../node_modules/d3-time/src/hour.js + var timeHour = timeInterval$1((date) => { + date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond$1 - date.getMinutes() * durationMinute$1); + }, (date, step) => { + date.setTime(+date + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date) => { + return date.getHours(); + }); + timeHour.range; + var utcHour = timeInterval$1((date) => { + date.setUTCMinutes(0, 0, 0); + }, (date, step) => { + date.setTime(+date + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date) => { + return date.getUTCHours(); + }); + utcHour.range; + //#endregion + //#region ../../node_modules/d3-time/src/day.js + var timeDay = timeInterval$1((date) => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, (date) => date.getDate() - 1); + timeDay.range; + var utcDay = timeInterval$1((date) => { + date.setUTCHours(0, 0, 0, 0); + }, (date, step) => { + date.setUTCDate(date.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date) => { + return date.getUTCDate() - 1; + }); + utcDay.range; + var unixDay = timeInterval$1((date) => { + date.setUTCHours(0, 0, 0, 0); + }, (date, step) => { + date.setUTCDate(date.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date) => { + return Math.floor(date / durationDay$1); + }); + unixDay.range; + //#endregion + //#region ../../node_modules/d3-time/src/week.js + function timeWeekday(i) { + return timeInterval$1((date) => { + date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); + date.setHours(0, 0, 0, 0); + }, (date, step) => { + date.setDate(date.getDate() + step * 7); + }, (start, end) => { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1; + }); + } + var timeSunday = timeWeekday(0); + var timeMonday = timeWeekday(1); + var timeTuesday = timeWeekday(2); + var timeWednesday = timeWeekday(3); + var timeThursday = timeWeekday(4); + var timeFriday = timeWeekday(5); + var timeSaturday = timeWeekday(6); + timeSunday.range; + timeMonday.range; + timeTuesday.range; + timeWednesday.range; + timeThursday.range; + timeFriday.range; + timeSaturday.range; + function utcWeekday(i) { + return timeInterval$1((date) => { + date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); + date.setUTCHours(0, 0, 0, 0); + }, (date, step) => { + date.setUTCDate(date.getUTCDate() + step * 7); + }, (start, end) => { + return (end - start) / durationWeek$1; + }); + } + var utcSunday = utcWeekday(0); + var utcMonday = utcWeekday(1); + var utcTuesday = utcWeekday(2); + var utcWednesday = utcWeekday(3); + var utcThursday = utcWeekday(4); + var utcFriday = utcWeekday(5); + var utcSaturday = utcWeekday(6); + utcSunday.range; + utcMonday.range; + utcTuesday.range; + utcWednesday.range; + utcThursday.range; + utcFriday.range; + utcSaturday.range; + //#endregion + //#region ../../node_modules/d3-time/src/month.js + var timeMonth = timeInterval$1((date) => { + date.setDate(1); + date.setHours(0, 0, 0, 0); + }, (date, step) => { + date.setMonth(date.getMonth() + step); + }, (start, end) => { + return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; + }, (date) => { + return date.getMonth(); + }); + timeMonth.range; + var utcMonth = timeInterval$1((date) => { + date.setUTCDate(1); + date.setUTCHours(0, 0, 0, 0); + }, (date, step) => { + date.setUTCMonth(date.getUTCMonth() + step); + }, (start, end) => { + return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; + }, (date) => { + return date.getUTCMonth(); + }); + utcMonth.range; + //#endregion + //#region ../../node_modules/d3-time/src/year.js + var timeYear = timeInterval$1((date) => { + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); + }, (date, step) => { + date.setFullYear(date.getFullYear() + step); + }, (start, end) => { + return end.getFullYear() - start.getFullYear(); + }, (date) => { + return date.getFullYear(); + }); + timeYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date) => { + date.setFullYear(Math.floor(date.getFullYear() / k) * k); + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); + }, (date, step) => { + date.setFullYear(date.getFullYear() + step * k); + }); + }; + timeYear.range; + var utcYear = timeInterval$1((date) => { + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); + }, (date, step) => { + date.setUTCFullYear(date.getUTCFullYear() + step); + }, (start, end) => { + return end.getUTCFullYear() - start.getUTCFullYear(); + }, (date) => { + return date.getUTCFullYear(); + }); + utcYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date) => { + date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); + }, (date, step) => { + date.setUTCFullYear(date.getUTCFullYear() + step * k); + }); + }; + utcYear.range; + //#endregion + //#region ../../node_modules/d3-time/src/ticks.js + function ticker(year, month, week, day, hour, minute) { + const tickIntervals = [ + [ + second, + 1, + durationSecond$1 + ], + [ + second, + 5, + 5 * durationSecond$1 + ], + [ + second, + 15, + 15 * durationSecond$1 + ], + [ + second, + 30, + 30 * durationSecond$1 + ], + [ + minute, + 1, + durationMinute$1 + ], + [ + minute, + 5, + 5 * durationMinute$1 + ], + [ + minute, + 15, + 15 * durationMinute$1 + ], + [ + minute, + 30, + 30 * durationMinute$1 + ], + [ + hour, + 1, + durationHour$1 + ], + [ + hour, + 3, + 3 * durationHour$1 + ], + [ + hour, + 6, + 6 * durationHour$1 + ], + [ + hour, + 12, + 12 * durationHour$1 + ], + [ + day, + 1, + durationDay$1 + ], + [ + day, + 2, + 2 * durationDay$1 + ], + [ + week, + 1, + durationWeek$1 + ], + [ + month, + 1, + durationMonth$1 + ], + [ + month, + 3, + 3 * durationMonth$1 + ], + [ + year, + 1, + durationYear$1 + ] + ]; + function ticks(start, stop, count) { + const reverse = stop < start; + if (reverse) [start, stop] = [stop, start]; + const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count); + const ticks = interval ? interval.range(start, +stop + 1) : []; + return reverse ? ticks.reverse() : ticks; + } + function tickInterval(start, stop, count) { + const target = Math.abs(stop - start) / count; + const i = bisector(([, , step]) => step).right(tickIntervals, target); + if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop / durationYear$1, count)); + if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1)); + const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; + return t.every(step); + } + return [ticks, tickInterval]; + } + var [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute); + var [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute); + //#endregion + //#region ../../node_modules/d3-time-format/src/locale.js + function localDate$1(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); + date.setFullYear(d.y); + return date; + } + return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); + } + function utcDate$1(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); + date.setUTCFullYear(d.y); + return date; + } + return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); + } + function newDate(y, m, d) { + return { + y, + m, + d, + H: 0, + M: 0, + S: 0, + L: 0 + }; + } + function formatLocale(locale) { + var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; + var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); + var formats = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "f": formatMicroseconds, + "g": formatYearISO, + "G": formatFullYearISO, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "q": formatQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatSeconds, + "u": formatWeekdayNumberMonday, + "U": formatWeekNumberSunday, + "V": formatWeekNumberISO, + "w": formatWeekdayNumberSunday, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear$1, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "f": formatUTCMicroseconds, + "g": formatUTCYearISO, + "G": formatUTCFullYearISO, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "q": formatUTCQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatUTCSeconds, + "u": formatUTCWeekdayNumberMonday, + "U": formatUTCWeekNumberSunday, + "V": formatUTCWeekNumberISO, + "w": formatUTCWeekdayNumberSunday, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "f": parseMicroseconds, + "g": parseYear, + "G": parseFullYear, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "q": parseQuarter, + "Q": parseUnixTimestamp, + "s": parseUnixTimestampSeconds, + "S": parseSeconds, + "u": parseWeekdayNumberMonday, + "U": parseWeekNumberSunday, + "V": parseWeekNumberISO, + "w": parseWeekdayNumberSunday, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + formats.x = newFormat(locale_date, formats); + formats.X = newFormat(locale_time, formats); + formats.c = newFormat(locale_dateTime, formats); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + function newFormat(specifier, formats) { + return function(date) { + var string = [], i = -1, j = 0, n = specifier.length, c, pad, format; + if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date); + while (++i < n) if (specifier.charCodeAt(i) === 37) { + string.push(specifier.slice(j, i)); + if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); + else pad = c === "e" ? " " : "0"; + if (format = formats[c]) c = format(date, pad); + string.push(c); + j = i + 1; + } + string.push(specifier.slice(j, i)); + return string.join(""); + }; + } + function newParse(specifier, Z) { + return function(string) { + var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day; + if (i != string.length) return null; + if ("Q" in d) return new Date(d.Q); + if ("s" in d) return new Date(d.s * 1e3 + ("L" in d ? d.L : 0)); + if (Z && !("Z" in d)) d.Z = 0; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + if (d.m === void 0) d.m = "q" in d ? d.q : 0; + if ("V" in d) { + if (d.V < 1 || d.V > 53) return null; + if (!("w" in d)) d.w = 1; + if ("Z" in d) { + week = utcDate$1(newDate(d.y, 0, 1)), day = week.getUTCDay(); + week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week); + week = utcDay.offset(week, (d.V - 1) * 7); + d.y = week.getUTCFullYear(); + d.m = week.getUTCMonth(); + d.d = week.getUTCDate() + (d.w + 6) % 7; + } else { + week = localDate$1(newDate(d.y, 0, 1)), day = week.getDay(); + week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week); + week = timeDay.offset(week, (d.V - 1) * 7); + d.y = week.getFullYear(); + d.m = week.getMonth(); + d.d = week.getDate() + (d.w + 6) % 7; + } + } else if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; + day = "Z" in d ? utcDate$1(newDate(d.y, 0, 1)).getUTCDay() : localDate$1(newDate(d.y, 0, 1)).getDay(); + d.m = 0; + d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; + } + if ("Z" in d) { + d.H += d.Z / 100 | 0; + d.M += d.Z % 100; + return utcDate$1(d); + } + return localDate$1(d); + }; + } + function parseSpecifier(d, specifier, string, j) { + var i = 0, n = specifier.length, m = string.length, c, parse; + while (i < n) { + if (j >= m) return -1; + c = specifier.charCodeAt(i++); + if (c === 37) { + c = specifier.charAt(i++); + parse = parses[c in pads ? specifier.charAt(i++) : c]; + if (!parse || (j = parse(d, string, j)) < 0) return -1; + } else if (c != string.charCodeAt(j++)) return -1; + } + return j; + } + function parsePeriod(d, string, i) { + var n = periodRe.exec(string.slice(i)); + return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseShortWeekday(d, string, i) { + var n = shortWeekdayRe.exec(string.slice(i)); + return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseWeekday(d, string, i) { + var n = weekdayRe.exec(string.slice(i)); + return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseShortMonth(d, string, i) { + var n = shortMonthRe.exec(string.slice(i)); + return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseMonth(d, string, i) { + var n = monthRe.exec(string.slice(i)); + return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseLocaleDateTime(d, string, i) { + return parseSpecifier(d, locale_dateTime, string, i); + } + function parseLocaleDate(d, string, i) { + return parseSpecifier(d, locale_date, string, i); + } + function parseLocaleTime(d, string, i) { + return parseSpecifier(d, locale_time, string, i); + } + function formatShortWeekday(d) { + return locale_shortWeekdays[d.getDay()]; + } + function formatWeekday(d) { + return locale_weekdays[d.getDay()]; + } + function formatShortMonth(d) { + return locale_shortMonths[d.getMonth()]; + } + function formatMonth(d) { + return locale_months[d.getMonth()]; + } + function formatPeriod(d) { + return locale_periods[+(d.getHours() >= 12)]; + } + function formatQuarter(d) { + return 1 + ~~(d.getMonth() / 3); + } + function formatUTCShortWeekday(d) { + return locale_shortWeekdays[d.getUTCDay()]; + } + function formatUTCWeekday(d) { + return locale_weekdays[d.getUTCDay()]; + } + function formatUTCShortMonth(d) { + return locale_shortMonths[d.getUTCMonth()]; + } + function formatUTCMonth(d) { + return locale_months[d.getUTCMonth()]; + } + function formatUTCPeriod(d) { + return locale_periods[+(d.getUTCHours() >= 12)]; + } + function formatUTCQuarter(d) { + return 1 + ~~(d.getUTCMonth() / 3); + } + return { + format: function(specifier) { + var f = newFormat(specifier += "", formats); + f.toString = function() { + return specifier; + }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", false); + p.toString = function() { + return specifier; + }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { + return specifier; + }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier += "", true); + p.toString = function() { + return specifier; + }; + return p; + } + }; + } + var pads = { + "-": "", + "_": " ", + "0": "0" + }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; + function pad$2(value, fill, width) { + var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); + } + function requote(s) { + return s.replace(requoteRe, "\\$&"); + } + function formatRe(names) { + return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); + } + function formatLookup(names) { + return new Map(names.map((name, i) => [name.toLowerCase(), i])); + } + function parseWeekdayNumberSunday(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 1)); + return n ? (d.w = +n[0], i + n[0].length) : -1; + } + function parseWeekdayNumberMonday(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 1)); + return n ? (d.u = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberSunday(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.U = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberISO(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.V = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberMonday(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.W = +n[0], i + n[0].length) : -1; + } + function parseFullYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 4)); + return n ? (d.y = +n[0], i + n[0].length) : -1; + } + function parseYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; + } + function parseZone(d, string, i) { + var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); + return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; + } + function parseQuarter(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 1)); + return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; + } + function parseMonthNumber(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.m = n[0] - 1, i + n[0].length) : -1; + } + function parseDayOfMonth(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.d = +n[0], i + n[0].length) : -1; + } + function parseDayOfYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; + } + function parseHour24(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.H = +n[0], i + n[0].length) : -1; + } + function parseMinutes(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.M = +n[0], i + n[0].length) : -1; + } + function parseSeconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.S = +n[0], i + n[0].length) : -1; + } + function parseMilliseconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.L = +n[0], i + n[0].length) : -1; + } + function parseMicroseconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 6)); + return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; + } + function parseLiteralPercent(d, string, i) { + var n = percentRe.exec(string.slice(i, i + 1)); + return n ? i + n[0].length : -1; + } + function parseUnixTimestamp(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.Q = +n[0], i + n[0].length) : -1; + } + function parseUnixTimestampSeconds(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.s = +n[0], i + n[0].length) : -1; + } + function formatDayOfMonth(d, p) { + return pad$2(d.getDate(), p, 2); + } + function formatHour24(d, p) { + return pad$2(d.getHours(), p, 2); + } + function formatHour12(d, p) { + return pad$2(d.getHours() % 12 || 12, p, 2); + } + function formatDayOfYear(d, p) { + return pad$2(1 + timeDay.count(timeYear(d), d), p, 3); + } + function formatMilliseconds(d, p) { + return pad$2(d.getMilliseconds(), p, 3); + } + function formatMicroseconds(d, p) { + return formatMilliseconds(d, p) + "000"; + } + function formatMonthNumber(d, p) { + return pad$2(d.getMonth() + 1, p, 2); + } + function formatMinutes(d, p) { + return pad$2(d.getMinutes(), p, 2); + } + function formatSeconds(d, p) { + return pad$2(d.getSeconds(), p, 2); + } + function formatWeekdayNumberMonday(d) { + var day = d.getDay(); + return day === 0 ? 7 : day; + } + function formatWeekNumberSunday(d, p) { + return pad$2(timeSunday.count(timeYear(d) - 1, d), p, 2); + } + function dISO(d) { + var day = d.getDay(); + return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); + } + function formatWeekNumberISO(d, p) { + d = dISO(d); + return pad$2(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); + } + function formatWeekdayNumberSunday(d) { + return d.getDay(); + } + function formatWeekNumberMonday(d, p) { + return pad$2(timeMonday.count(timeYear(d) - 1, d), p, 2); + } + function formatYear$1(d, p) { + return pad$2(d.getFullYear() % 100, p, 2); + } + function formatYearISO(d, p) { + d = dISO(d); + return pad$2(d.getFullYear() % 100, p, 2); + } + function formatFullYear(d, p) { + return pad$2(d.getFullYear() % 1e4, p, 4); + } + function formatFullYearISO(d, p) { + var day = d.getDay(); + d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); + return pad$2(d.getFullYear() % 1e4, p, 4); + } + function formatZone(d) { + var z = d.getTimezoneOffset(); + return (z > 0 ? "-" : (z *= -1, "+")) + pad$2(z / 60 | 0, "0", 2) + pad$2(z % 60, "0", 2); + } + function formatUTCDayOfMonth(d, p) { + return pad$2(d.getUTCDate(), p, 2); + } + function formatUTCHour24(d, p) { + return pad$2(d.getUTCHours(), p, 2); + } + function formatUTCHour12(d, p) { + return pad$2(d.getUTCHours() % 12 || 12, p, 2); + } + function formatUTCDayOfYear(d, p) { + return pad$2(1 + utcDay.count(utcYear(d), d), p, 3); + } + function formatUTCMilliseconds(d, p) { + return pad$2(d.getUTCMilliseconds(), p, 3); + } + function formatUTCMicroseconds(d, p) { + return formatUTCMilliseconds(d, p) + "000"; + } + function formatUTCMonthNumber(d, p) { + return pad$2(d.getUTCMonth() + 1, p, 2); + } + function formatUTCMinutes(d, p) { + return pad$2(d.getUTCMinutes(), p, 2); + } + function formatUTCSeconds(d, p) { + return pad$2(d.getUTCSeconds(), p, 2); + } + function formatUTCWeekdayNumberMonday(d) { + var dow = d.getUTCDay(); + return dow === 0 ? 7 : dow; + } + function formatUTCWeekNumberSunday(d, p) { + return pad$2(utcSunday.count(utcYear(d) - 1, d), p, 2); + } + function UTCdISO(d) { + var day = d.getUTCDay(); + return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); + } + function formatUTCWeekNumberISO(d, p) { + d = UTCdISO(d); + return pad$2(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); + } + function formatUTCWeekdayNumberSunday(d) { + return d.getUTCDay(); + } + function formatUTCWeekNumberMonday(d, p) { + return pad$2(utcMonday.count(utcYear(d) - 1, d), p, 2); + } + function formatUTCYear(d, p) { + return pad$2(d.getUTCFullYear() % 100, p, 2); + } + function formatUTCYearISO(d, p) { + d = UTCdISO(d); + return pad$2(d.getUTCFullYear() % 100, p, 2); + } + function formatUTCFullYear(d, p) { + return pad$2(d.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCFullYearISO(d, p) { + var day = d.getUTCDay(); + d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); + return pad$2(d.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCZone() { + return "+0000"; + } + function formatLiteralPercent() { + return "%"; + } + function formatUnixTimestamp(d) { + return +d; + } + function formatUnixTimestampSeconds(d) { + return Math.floor(+d / 1e3); + } + //#endregion + //#region ../../node_modules/d3-time-format/src/defaultLocale.js + var locale$2; + var timeFormat$1; + var timeParse$1; + var utcFormat$1; + var utcParse$1; + defaultLocale$2({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + shortDays: [ + "Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat" + ], + months: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + shortMonths: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ] + }); + function defaultLocale$2(definition) { + locale$2 = formatLocale(definition); + timeFormat$1 = locale$2.format; + timeParse$1 = locale$2.parse; + utcFormat$1 = locale$2.utcFormat; + utcParse$1 = locale$2.utcParse; + return locale$2; + } + //#endregion + //#region ../../node_modules/d3-scale/src/time.js + function date(t) { + return new Date(t); + } + function number$4(t) { + return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t); + } + function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) { + var scale = continuous$1(), invert = scale.invert, domain = scale.domain; + var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y"); + function tickFormat(date) { + return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); + } + scale.invert = function(y) { + return new Date(invert(y)); + }; + scale.domain = function(_) { + return arguments.length ? domain(Array.from(_, number$4)) : domain().map(date); + }; + scale.ticks = function(interval) { + var d = domain(); + return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval); + }; + scale.tickFormat = function(count, specifier) { + return specifier == null ? tickFormat : format(specifier); + }; + scale.nice = function(interval) { + var d = domain(); + if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); + return interval ? domain(nice(d, interval)) : scale; + }; + scale.copy = function() { + return copy$2(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format)); + }; + return scale; + } + function time$1() { + return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat$1).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); + } + //#endregion + //#region ../../node_modules/d3-scale/src/utcTime.js + function utcTime() { + return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat$1).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); + } + //#endregion + //#region ../../node_modules/d3-scale/src/sequential.js + function transformer$2() { + var x0 = 0, x1 = 1, t0, t1, k10, transform, interpolator = identity$2, clamp = false, unknown; + function scale(x) { + return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? .5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); + } + scale.domain = function(_) { + return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; + }; + scale.clamp = function(_) { + return arguments.length ? (clamp = !!_, scale) : clamp; + }; + scale.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale) : interpolator; + }; + function range(interpolate) { + return function(_) { + var r0, r1; + return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; + }; + } + scale.range = range(value_default); + scale.rangeRound = range(round_default$1); + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + return function(t) { + transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); + return scale; + }; + } + function copy$1(source, target) { + return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown()); + } + function sequential() { + var scale = linearish(transformer$2()(identity$2)); + scale.copy = function() { + return copy$1(scale, sequential()); + }; + return initInterpolator.apply(scale, arguments); + } + function sequentialLog() { + var scale = loggish(transformer$2()).domain([1, 10]); + scale.copy = function() { + return copy$1(scale, sequentialLog()).base(scale.base()); + }; + return initInterpolator.apply(scale, arguments); + } + function sequentialSymlog() { + var scale = symlogish(transformer$2()); + scale.copy = function() { + return copy$1(scale, sequentialSymlog()).constant(scale.constant()); + }; + return initInterpolator.apply(scale, arguments); + } + function sequentialPow() { + var scale = powish(transformer$2()); + scale.copy = function() { + return copy$1(scale, sequentialPow()).exponent(scale.exponent()); + }; + return initInterpolator.apply(scale, arguments); + } + function sequentialSqrt() { + return sequentialPow.apply(null, arguments).exponent(.5); + } + //#endregion + //#region ../../node_modules/d3-scale/src/diverging.js + function transformer$1() { + var x0 = 0, x1 = .5, x2 = 1, s = 1, t0, t1, t2, k10, k21, interpolator = identity$2, transform, clamp = false, unknown; + function scale(x) { + return isNaN(x = +x) ? unknown : (x = .5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); + } + scale.domain = function(_) { + return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : .5 / (t1 - t0), k21 = t1 === t2 ? 0 : .5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [ + x0, + x1, + x2 + ]; + }; + scale.clamp = function(_) { + return arguments.length ? (clamp = !!_, scale) : clamp; + }; + scale.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale) : interpolator; + }; + function range(interpolate) { + return function(_) { + var r0, r1, r2; + return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate, [ + r0, + r1, + r2 + ]), scale) : [ + interpolator(0), + interpolator(.5), + interpolator(1) + ]; + }; + } + scale.range = range(value_default); + scale.rangeRound = range(round_default$1); + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + return function(t) { + transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : .5 / (t1 - t0), k21 = t1 === t2 ? 0 : .5 / (t2 - t1), s = t1 < t0 ? -1 : 1; + return scale; + }; + } + function diverging$1() { + var scale = linearish(transformer$1()(identity$2)); + scale.copy = function() { + return copy$1(scale, diverging$1()); + }; + return initInterpolator.apply(scale, arguments); + } + function divergingLog() { + var scale = loggish(transformer$1()).domain([ + .1, + 1, + 10 + ]); + scale.copy = function() { + return copy$1(scale, divergingLog()).base(scale.base()); + }; + return initInterpolator.apply(scale, arguments); + } + function divergingSymlog() { + var scale = symlogish(transformer$1()); + scale.copy = function() { + return copy$1(scale, divergingSymlog()).constant(scale.constant()); + }; + return initInterpolator.apply(scale, arguments); + } + function divergingPow() { + var scale = powish(transformer$1()); + scale.copy = function() { + return copy$1(scale, divergingPow()).exponent(scale.exponent()); + }; + return initInterpolator.apply(scale, arguments); + } + function divergingSqrt() { + return divergingPow.apply(null, arguments).exponent(.5); + } + //#endregion + //#region ../sanddance/dist/es6/transition.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function assignTransitionStagger(transition, currentData, selection, presenter) { + const { layerStagger } = presenter.morphchartsref; + const { morphChartsRenderResult } = presenter; + const cubelayer = morphChartsRenderResult.getCubeLayer(); + const range = transition.reverse ? [1, 0] : [0, 1]; + if (!transition || transition.type === "ordinal" && !transition.reverse) delete layerStagger.cubes; + else { + const staggerOrders = new Float64Array(cubelayer.positionsX.length); + switch (transition.type) { + case "ordinal": { + const scale = linear$1(range).domain([0, currentData.length]); + currentData.forEach((datum, i) => { + const glOrdinal = datum[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale(i); + }); + break; + } + case "column": + if (transition.column.quantitative) { + const values = new Float64Array(currentData.length); + currentData.forEach((datum, i) => { + values[i] = datum[transition.column.name]; + }); + const stats = getStats(currentData, transition.column); + const scale = linear$1(range).domain([stats.min, stats.max]); + currentData.forEach((datum, i) => { + const glOrdinal = datum[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale(values[i]); + }); + } else { + const strings = new Array(currentData.length); + currentData.forEach((datum, i) => { + strings[i] = datum[transition.column.name]; + }); + getStats(currentData, transition.column, (distictValues) => { + currentData.forEach((datum, i) => { + const glOrdinal = datum[GL_ORDINAL]; + const staggerOrder = distictValues.indexOf(strings[i]) / distictValues.length; + staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; + }); + }); + } + break; + case "position": { + const positions = { + x: cubelayer.positionsX, + y: cubelayer.positionsY, + z: cubelayer.positionsZ + }[transition.dimension]; + const values = new Float64Array(currentData.length); + currentData.forEach((datum, i) => { + values[i] = positions[datum[GL_ORDINAL]]; + }); + const stats = getStats(values, null, "number", true); + const scale = linear$1(range).domain([stats.min, stats.max]); + currentData.forEach((datum, i) => { + const glOrdinal = datum[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale(values[i]); + }); + break; + } + } + layerStagger.cubes = { + staggerOrders, + maxStaggerOrder: 1, + minStaggerOrder: 0 + }; + } + cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); + } + //#endregion + //#region ../sanddance/dist/es6/viewer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + 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) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var { defaultView } = defaults_exports; + var zAxisZindex = 1010; + var didRegisterColorSchemes = false; + /** + * Component to view a SandDance data visualization. + */ + var Viewer$1 = class { + /** + * Instantiate a new Viewer. + * @param element Parent HTMLElement to present within. + * @param options Optional viewer options object. + */ + constructor(element, options) { + this.element = element; + this.options = deepMerge(defaultViewerOptions$1, options); + this.presenter = new Presenter(element, getPresenterStyle(this.options)); + this._characterSet = new CharacterSet(); + this._dataScope = new DataScope$2(); + this._animator = new Animator(this._dataScope, { + onDataChanged: this.onDataChanged.bind(this), + onAnimateDataChange: this.onAnimateDataChange.bind(this) + }); + this._details = new Details(this.presenter.getElement(PresenterElement$1.panel), this.options.language, this._animator, this._dataScope, (remap) => { + this.currentColorContext = ~~remap; + this.renderSameLayout(); + }, () => this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); + this.insight = {}; + } + changeColorContexts(colorContexts) { + this.colorContexts = colorContexts; + this.currentColorContext = 0; + this.options.onColorContextChange && this.options.onColorContextChange(); + } + applyLegendColorContext(colorContext) { + const a = getActiveElementInfo(); + mount(colorContext.legendElement, this.presenter.getElement(PresenterElement$1.legend)); + setActiveElement(a); + this.presenter.stage.legend = colorContext.legend; + } + onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time) { + var _a; + if (time === void 0) { + const transitionDurations = ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) || defaultPresenterConfig.transitionDurations; + time = transitionDurations.position + transitionDurations.stagger; + } + return new Promise((resolve, reject) => { + let innerPromise; + if (dataChange === DataLayoutChange.refine) { + const oldColorContext = this.colorContexts[this.currentColorContext]; + innerPromise = new Promise((innerResolve) => { + this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + cubeLayer.unitColorMap = oldColorContext.colorMap; + if (this.options.onStage) this.options.onStage(stage); + } })).then(() => { + this.applyLegendColorContext(oldColorContext); + innerResolve(); + }); + }); + } else innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, colorMapper) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + if (this.options.onStage) this.options.onStage(stage); + } })); + innerPromise.then(() => { + this.presenter.animationQueue(resolve, time, { + waitingLabel, + handlerLabel, + animationCanceled: reject + }); + }); + }); + } + onDataChanged(dataLayout, filter) { + return __awaiter(this, void 0, void 0, function* () { + switch (dataLayout) { + case DataLayoutChange.same: { + const hasSelectedData = this._dataScope.hasSelectedData(); + const hasActive = !!this._dataScope.active; + if (hasSelectedData || hasActive) this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); + else this.presenter.morphChartsRenderResult.update({ cubes: null }); + break; + } + case DataLayoutChange.refine: { + const oldColorContext = this.colorContexts[this.currentColorContext]; + let colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { + preStage: (stage, cubeLayer) => { + colorMap = cubeLayer.unitColorMap; + cubeLayer.unitColorMap = oldColorContext.colorMap; + this.preStage(stage, cubeLayer); + }, + onPresent: () => { + const newColorContext = { + colorMap, + legend: clone(this.presenter.stage.legend), + legendElement: this.presenter.getElement(PresenterElement$1.legend).children[0] + }; + this.applyLegendColorContext(oldColorContext); + this.changeColorContexts([oldColorContext, newColorContext]); + this.onPresent(); + } + })); + if (!compare$3(this.insight.filter, filter)) this.insight.filter = narrow(this.insight.filter, filter); + if (this.options.onDataFilter) this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); + break; + } + case DataLayoutChange.reset: { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null + }; + this.changeColorContexts([colorContext]); + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { onPresent: () => { + populateColorContext(colorContext, this.presenter); + this.onPresent(); + } })); + delete this.insight.filter; + if (this.options.onDataFilter) this.options.onDataFilter(null, null); + break; + } + } + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); + } + }); + } + convertSearchToSet() { + if (this._dataScope.selection) { + const s = /* @__PURE__ */ new Set(); + let found = false; + this._dataScope.selection.included.forEach((o, i) => { + s.add(o[GL_ORDINAL]); + found = true; + }); + if (!found) s.add(-1); + return s; + } + } + convertSetToSearch(s) { + const search = { expressions: [] }; + s.forEach((value) => { + search.expressions.push({ + name: GL_ORDINAL, + operator: "==", + value, + clause: "||" + }); + }); + return search; + } + getSpecColumnsWithFilteredStats() { + if (!this._dataScope.hasFilteredData()) return this._specColumns; + const roles = [ + "color", + "facet", + "group", + "size", + "sort", + "sum", + "x", + "y", + "z" + ]; + const specColumns = Object.assign({}, this._specColumns); + roles.forEach((r) => { + if (specColumns[r]) { + const column = Object.assign({}, specColumns[r]); + column.stats = this.getColumnStats(column); + specColumns[r] = column; + } + }); + return specColumns; + } + renderNewLayout(signalValues, presenterConfig, view) { + return __awaiter(this, void 0, void 0, function* () { + const currData = this._dataScope.currentData(); + const specResult = build({ + specColumns: this.getSpecColumnsWithFilteredStats(), + insight: this.insight, + specViewOptions: Object.assign(Object.assign({}, this.options), { + zAxisOptions: { + showZAxis: true, + zIndex: zAxisZindex + }, + collapseFacetAxes: true + }) + }, currData); + if (!specResult.errors) { + const uiValues = extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); + applySignalValues(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); + unbindSignalUI(specResult.vegaSpec); + this.vegaSpec = specResult.vegaSpec; + this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); + this.specCapabilities = specResult.specCapabilities; + const config = this.createConfig(presenterConfig); + this._lastPresenterConfig = config.presenterConfig; + if (view) config.getView = () => view; + if (!didRegisterColorSchemes) { + registerColorSchemes(base$3.vega); + didRegisterColorSchemes = true; + } + try { + if (this.vegaViewGl) this.vegaViewGl.finalize(); + const runtime = base$3.vega.parse(this.vegaSpec); + this.vegaViewGl = new ViewGl(runtime, config).renderer("morphcharts").initialize(this.element); + yield this.vegaViewGl.runAsync(); + const handler = (n, v) => { + this._characterSet.resetCharacterSet(true); + }; + this.vegaSpec.signals.forEach((s) => { + this.vegaViewGl.addSignalListener(s.name, handler); + }); + this.configForSignalCapture(config.presenterConfig); + } catch (e) { + specResult.errors = [e.message]; + } + if (!specResult.errors) ensureHeaders(this.presenter, this.options.language.headers); + } + if (specResult.errors) { + if (this.options.onError) this.options.onError(specResult.errors); + else if (this.presenter.logger) this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join("\n")}`); + } + return specResult; + }); + } + /** + * Render the same layout with new options. + * @param newViewerOptions New options object. + */ + renderSameLayout(newViewerOptions) { + const colorContext = this.colorContexts[this.currentColorContext]; + this.applyLegendColorContext(colorContext); + if (newViewerOptions) { + if (newViewerOptions.colors) { + const mcColors = this.getMorphChartsColors(); + this.presenter.configColors(mcColors); + this._lastPresenterConfig.morphChartsColors = mcColors; + } + this.options = deepMerge(this.options, newViewerOptions); + } + this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); + } + getView(view) { + if (view === void 0) if (this.presenter.view === null) return defaultView; + else return this.presenter.view; + else return view; + } + transformData(values, transform) { + try { + new ViewGl(base$3.vega.parse({ + $schema: "https://vega.github.io/schema/vega/v4.json", + data: [{ + name: "source", + values, + transform + }] + })).run(); + } catch (e) {} + return values; + } + /** + * Render data into a visualization. + * @param insightSetup InsightSetup object to create a visualization rendering. + * @param data Array of data objects. + * @param renderOptions Optional RenderOptions object. + */ + render(insightSetup_1, data_1) { + return __awaiter(this, arguments, void 0, function* (insightSetup, data, renderOptions = {}) { + const { insight, setup } = insightSetup; + let result; + if (!compare$3(insight.filter, this.insight.filter)) { + const transitionDurations = (setup === null || setup === void 0 ? void 0 : setup.transitionDurations) || defaultPresenterConfig.transitionDurations; + const allowAsyncRenderTime = transitionDurations.position + transitionDurations.stagger + this.options.filterRenderingTimerPadding; + if (insight.filter) { + result = yield this._render(insightSetup, data, renderOptions, true); + this.presenter.animationQueue(() => { + this.filter(insight.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); + }, allowAsyncRenderTime, { + waitingLabel: "layout before refine", + handlerLabel: "refine after layout" + }); + } else { + this._dataScope.setFilteredData(null); + result = yield this._render(insightSetup, data, renderOptions, true); + this.presenter.animationQueue(() => { + this.reset(); + }, allowAsyncRenderTime, { + waitingLabel: "layout before reset", + handlerLabel: "reset after layout" + }); + } + } else result = yield this._render(insightSetup, data, renderOptions, false); + return result; + }); + } + shouldViewstateTransition(newInsight, oldInsight) { + if (!oldInsight.columns) return false; + if (oldInsight.chart !== newInsight.chart) return true; + if (oldInsight.size.height !== newInsight.size.height) return true; + if (oldInsight.size.width !== newInsight.size.width) return true; + if (oldInsight.columns.facet !== newInsight.columns.facet) return true; + return false; + } + configForSignalCapture(presenterConfig) { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null + }; + presenterConfig.preStage = (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) colorContext.colorMap = cubeLayer.unitColorMap; + this.preStage(stage, cubeLayer); + }; + presenterConfig.onPresent = () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + this._dataScope.deselect(); + } + this.onPresent(); + }; + } + onPresent() { + var _a; + if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transition) assignTransitionStagger(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + this.options.onPresent && this.options.onPresent(); + } + _render(insightSetup, data, renderOptions, forceNewCharacterSet) { + return __awaiter(this, void 0, void 0, function* () { + const { insight, setup } = insightSetup; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (this._dataScope.setData(data, renderOptions.columns)) this.transformData(data, insight.transform); + this._specColumns = getSpecColumns(insight, this._dataScope.getColumns(renderOptions.columnTypes)); + const ordinalMap = assignOrdinals(this._specColumns, data, renderOptions.ordinalMap); + this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight); + this.insight = clone(insight); + this.setup = setup; + this._shouldSaveColorContext = () => !renderOptions.initialColorContext; + const colorContext = renderOptions.initialColorContext || { + colorMap: null, + legend: null, + legendElement: null + }; + const specResult = yield this.renderNewLayout(insight.signalValues, Object.assign(Object.assign({}, setup || {}), { + preStage: (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) colorContext.colorMap = cubeLayer.unitColorMap; + else cubeLayer.unitColorMap = colorContext.colorMap; + if (!!this._dataScope.hasSelectedData() || this._dataScope.active) {} + this.preStage(stage, cubeLayer); + }, + onPresent: () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + } else this.applyLegendColorContext(colorContext); + this.onPresent(); + }, + shouldViewstateTransition: () => this.shouldViewstateTransition(insight, this.insight) + }), this.getView(insight.view)); + this._shouldSaveColorContext = () => !renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); + this._details.render(); + return { + ordinalMap, + specResult + }; + }); + } + overrideAxisLabels(stage) {} + preLayer(stage) { + let axisRole; + for (axisRole in stage.axes) { + const capability = this.specCapabilities.roles.filter((r) => r.role === axisRole)[0]; + if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === "exact")) moveTicksBetween(stage.axes[axisRole]); + } + } + preStage(stage, cubeLayer) { + this.overrideAxisLabels(stage); + this._axisSelection = new AxisSelection(this.specCapabilities, this._specColumns, stage); + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + if (this.options.onStage) this.options.onStage(stage); + } + onCubeClick(e, cube) { + this.options.onCubeClick && this.options.onCubeClick(e, cube); + const hasSelectedData = this._dataScope.hasSelectedData(); + if (hasSelectedData && this._dataScope.selection.included.length > 1) { + const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); + if (indexWithinSelection.index >= 0) { + this.activate(indexWithinSelection.datum); + this._details.populate(this._dataScope.selection, indexWithinSelection.index); + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); + } + return; + } + } + if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0]["GL_ORDINAL"] === cube.ordinal) { + this.deselect(); + return; + } + const search = { + name: GL_ORDINAL, + operator: "==", + value: cube.ordinal + }; + this.select(search); + } + onCubeHover(event, cube) { + var _a, _b; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (!cube) return; + const currentData = this._dataScope.currentData(); + const index = getDataIndexOfCube(cube, currentData); + if (index >= 0) { + const tooltipCreateOptions = { + dataItem: cleanDataItem(((_a = this.options.tooltipOptions) === null || _a === void 0 ? void 0 : _a.prepareDataItem(currentData[index])) || currentData[index]), + event + }; + if ((_b = this.options.tooltipOptions) === null || _b === void 0 ? void 0 : _b.create) this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); + else this._tooltip = new Tooltip$1(Object.assign(Object.assign({}, tooltipCreateOptions), { cssPrefix: this.presenter.style.cssPrefix })); + } + } + onTextHover(e, t) { + if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) return false; + return !colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); + } + getMorphChartsColors() { + const { colors } = this.options; + return { + activeItemColor: colors.activeCube, + axesGridBackgroundColor: colors.backgroundColor, + axesGridHighlightColor: colors.axisSelectHighlight, + axesGridMajorColor: colors.gridLine, + axesGridMinorColor: colors.gridLine, + axesGridZeroColor: colors.gridLine, + axesTextHeadingColor: colors.axisText, + axesTextLabelColor: colors.axisText, + axesTextTitleColor: colors.axisText, + backgroundColor: colors.backgroundColor, + textBorderColor: colors.backgroundColor, + textColor: colors.axisText + }; + } + createConfig(c) { + var _a; + const { getTextColor, getTextHighlightColor, onTextClick } = this.options; + const defaultPresenterConfig = { + morphChartsColors: this.getMorphChartsColors(), + zAxisZindex, + getCharacterSet: (stage) => this._characterSet.getCharacterSet(stage), + getTextColor, + getTextHighlightColor, + onTextClick: (e, t) => { + if (t.metaData && t.metaData.search) { + const search = getSearchGroupFromVegaValue(t.metaData.search); + if (this.options.onAxisClick) this.options.onAxisClick(e, search); + else this.select(search); + } + if (onTextClick) onTextClick(e, t); + }, + onCubeClick: this.onCubeClick.bind(this), + onCubeHover: this.onCubeHover.bind(this), + onTextHover: this.onTextHover.bind(this), + preLayer: this.preLayer.bind(this), + preStage: this.preStage.bind(this), + onPresent: this.onPresent.bind(this), + onAxisConfig: (cartesian, dim3d, axis) => { + if (!axis) return; + const role = this.specCapabilities.roles.filter((r) => r.role === axis.axisRole)[0]; + if (role === null || role === void 0 ? void 0 : role.axisSelection) { + cartesian.isDivisionPickingEnabled[dim3d] = true; + cartesian.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; + cartesian.isLabelPickingEnabled[dim3d] = true; + cartesian.isTitlePickingEnabled[dim3d] = true; + cartesian.isHeadingPickingEnabled[dim3d] = true; + cartesian.isGridPickingEnabled = false; + } + }, + onAxesComplete: (cartesian) => {}, + axisPickGridCallback: (divisions, e) => { + const search = this._axisSelection.convert(divisions); + if (this.options.onAxisClick) this.options.onAxisClick(e, search); + else this.select(search); + }, + onLayerClick: (e) => { + this.options.onCanvasClick && this.options.onCanvasClick(e); + this.deselect(); + }, + onLegendClick: (e, legend, clickedIndex) => { + const legendRow = clickedIndex !== null && legend.rows[clickedIndex]; + if (legendRow) if (this.options.onLegendRowClick) this.options.onLegendRowClick(e, legendRow); + else this.select(legendRow.search); + else if (this.options.onLegendHeaderClick) this.options.onLegendHeaderClick(e); + }, + onSceneRectAssignCubeOrdinal: (datum) => { + return datum[GL_ORDINAL]; + }, + onTargetViewState: (h, w) => { + const { height, width } = this.insight.size; + let newViewStateTarget; + if (this.options.onNewViewStateTarget) newViewStateTarget = this.options.onNewViewStateTarget(); + return { + height, + width, + newViewStateTarget + }; + }, + layerSelection: { cubes: this.convertSearchToSet() }, + preserveDrawingBuffer: this.options.preserveDrawingBuffer + }; + if (!this.options.disableLasso) defaultPresenterConfig.onLasso = (ids, e) => { + this.deselect(); + const search = this.convertSetToSearch(ids); + this.select(search); + }; + if (this.options.onBeforeCreateLayers) defaultPresenterConfig.preLayer = (stage) => { + this.preLayer(stage); + this.options.onBeforeCreateLayers(stage, this.specCapabilities); + }; + const config = { + presenter: this.presenter, + presenterConfig: Object.assign(defaultPresenterConfig, c) + }; + if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) config.presenterConfig.transitionDurations = this.setup.transitionDurations; + return config; + } + /** + * Filter the data and animate. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. + */ + filter(search, rebase = false) { + const u = this._dataScope.createUserSelection(search, false, rebase); + return new Promise((resolve, reject) => { + this._animator.filter(search, u.included, u.excluded, rebase).then(() => { + this._details.clear(); + this._details.clearSelection(); + this._details.populate(this._dataScope.selection); + resolve(); + }); + }); + } + /** + * Remove any filtration and animate. + */ + reset() { + return new Promise((resolve, reject) => { + this._animator.reset().then(() => { + this._details.clear(); + this._details.clearSelection(); + resolve(); + }); + }); + } + /** + * Select cubes by a filter expression. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + */ + select(search) { + return new Promise((resolve, reject) => { + this._animator.select(search).then(() => { + this._details.populate(this._dataScope.selection); + resolve(); + }); + }); + } + /** + * Removes any selection. + */ + deselect() { + return new Promise((resolve, reject) => { + this._animator.deselect().then(() => { + this._details.clearSelection(); + resolve(); + }); + }); + } + /** + * Gets the current selection. + */ + getSelection() { + if (!this._dataScope) return null; + return { + search: this._dataScope.selection && this._dataScope.selection.search || null, + selectedData: this._dataScope.selection && this._dataScope.selection.included || null, + active: this._dataScope.active + }; + } + /** + * Set one data row to the active state. + */ + activate(datum) { + return new Promise((resolve, reject) => { + this._animator.activate(datum).then(() => { + this.presenter.morphChartsRenderResult.activate(datum[GL_ORDINAL]); + this._details.render(); + resolve(); + }); + }); + } + /** + * Deactivate item. + */ + deActivate() { + return new Promise((resolve, reject) => { + if (this._dataScope && this._dataScope.active) this._animator.deactivate().then(() => { + this.presenter.morphChartsRenderResult.activate(-1); + this._details.render(); + resolve(); + }); + else resolve(); + }); + } + /** + * Gets the current camera. + * @param transitionFinal Optional flag to get camera destination when transition completes. + */ + getCamera(transitionFinal = false) { + var _a, _b, _c, _d, _e, _f, _g; + let position = [ + 0, + 0, + 0 + ]; + let rotation = [ + 0, + 0, + 0, + 0 + ]; + if (transitionFinal) { + position = Array.from((_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.cameraTransitioner.vPosition.to); + rotation = Array.from((_d = (_c = this.presenter) === null || _c === void 0 ? void 0 : _c.morphchartsref) === null || _d === void 0 ? void 0 : _d.cameraTransitioner.qRotation.to); + } else { + const camera = (_g = (_f = (_e = this.presenter) === null || _e === void 0 ? void 0 : _e.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; + if (camera) { + camera.getPosition(position); + camera.getOrbit(rotation); + } + } + return { + position, + rotation, + captureSize: this.insight.size + }; + } + /** + * Sets the current camera. + * @param camera Camera to set. + */ + setCamera(camera) { + var _a, _b; + if (camera) (_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphChartsRenderResult) === null || _b === void 0 || _b.moveCamera(camera); + } + /** + * Gets the current insight with signal values. + */ + getInsight() { + const insight = Object.assign({}, this.insight); + insight.signalValues = this.getSignalValues(); + return insight; + } + /** + * Gets column stats from current data (filtered or all). + * @param column Column to get stats for. + */ + getColumnStats(column) { + return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; + } + /** + * Gets current signal values. + */ + getSignalValues() { + return extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); + } + assignTransitionStagger(transition) { + assignTransitionStagger(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + } + finalize() { + if (this._dataScope) this._dataScope.finalize(); + if (this._details) this._details.finalize(); + if (this._tooltip) this._tooltip.destroy(); + if (this.vegaViewGl) this.vegaViewGl.finalize(); + if (this.presenter) this.presenter.finalize(); + if (this.element) this.element.innerHTML = ""; + this.colorContexts = null; + this.element = null; + this.options = null; + this.presenter = null; + this.vegaSpec = null; + this.vegaViewGl = null; + this._animator = null; + this._dataScope = null; + this._details = null; + this._tooltip = null; + } + }; + /** + * Default Viewer options. + */ + Viewer$1.defaultViewerOptions = defaultViewerOptions$1; + //#endregion + //#region ../sanddance/dist/es6/version.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var version$4 = "4.0.6"; + //#endregion + //#region ../sanddance/dist/es6/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var es6_exports$2 = /* @__PURE__ */ __exportAll({ + VegaMorphCharts: () => es6_exports$3, + Viewer: () => Viewer$1, + colorSchemes: () => colorSchemes, + constants: () => constants_exports, + searchExpression: () => es6_exports$4, + specs: () => es6_exports$5, + types: () => types_exports$1, + use: () => use$4, + util: () => util_exports$1, + version: () => version$4 + }); + var use$4 = use$5; + //#endregion + //#region ../../node_modules/just-compare/index.esm.js + var index_esm_exports = /* @__PURE__ */ __exportAll({ default: () => collectionCompare }); + var collectionCompare = compare$2; + function compare$2(value1, value2) { + if (value1 === value2) return true; + if (value1 !== value1 && value2 !== value2) return true; + if ({}.toString.call(value1) != {}.toString.call(value2)) return false; + if (value1 !== Object(value1)) return false; + if (!value1) return false; + if (Array.isArray(value1)) return compareArrays(value1, value2); + if ({}.toString.call(value1) == "[object Set]") return compareArrays(Array.from(value1), Array.from(value2)); + if ({}.toString.call(value1) == "[object Object]") return compareObjects(value1, value2); + else return compareNativeSubtypes(value1, value2); + } + function compareNativeSubtypes(value1, value2) { + return value1.toString() === value2.toString(); + } + function compareArrays(value1, value2) { + var len = value1.length; + if (len != value2.length) return false; + var alike = true; + for (var i = 0; i < len; i++) if (!compare$2(value1[i], value2[i])) { + alike = false; + break; + } + return alike; + } + function compareObjects(value1, value2) { + var keys1 = Object.keys(value1).sort(); + var keys2 = Object.keys(value2).sort(); + var len = keys1.length; + if (len != keys2.length) return false; + for (var i = 0; i < len; i++) { + var key1 = keys1[i]; + var key2 = keys2[i]; + if (!(key1 == key2 && compare$2(value1[key1], value2[key2]))) return false; + } + return true; + } + //#endregion + //#region ../sanddance-react/dist/es6/util.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var util_exports = /* @__PURE__ */ __exportAll({ + classList: () => classList, + compareInsight: () => compareInsight, + deepCompare: () => deepCompare + }); + var classList = (...args) => { + return args.filter(Boolean).join(" "); + }; + var deepCompare = collectionCompare || index_esm_exports; + function addNullable(insight, signalValues) { + return Object.assign(Object.assign({ + view: null, + filter: null + }, insight), { signalValues }); + } + function compareInsight(viewer, insight) { + const currentInsight = viewer.getInsight(); + const a = addNullable(currentInsight, Object.assign(Object.assign({}, viewer.insight.signalValues), currentInsight.signalValues)); + const b = addNullable(insight, Object.assign(Object.assign({}, a.signalValues), insight.signalValues)); + return { + a, + b, + compare: deepCompare(a, b) + }; + } + //#endregion + //#region ../sanddance-react/dist/es6/base.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var base$2 = { + react: null, + reactDOM: null + }; + /** + * Specify the dependency libraries to use for rendering. + * @param react React library. + * @param vega Vega library. + * @param deck @deck.gl/core library. + * @param layers @deck.gl/layers library. + * @param luma @luma.gl/core library. + */ + function use$3(react, reactDOM, vega) { + use$5(vega); + base$2.react = react; + base$2.reactDOM = reactDOM; + Viewer.prototype = react.Component.prototype; + } + //#endregion + //#region ../sanddance-react/dist/es6/viewer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function _Viewer(_props) { + class __Viewer extends base$2.react.Component { + layout() { + const { props } = this; + this.lastData = props.data; + this.viewer.render({ + insight: props.insight, + setup: props.setup + }, props.data, props.renderOptions).then((renderResult) => { + props.onView && props.onView(renderResult); + }).catch((e) => { + props.onError && props.onError(e); + }); + } + view() { + var _a, _b, _c, _d, _e; + const { props } = this; + let didLayout = false; + if (props.insight && props.data) { + const c = compareInsight(this.viewer, props.insight); + const sameDataRef = props.data === this.lastData; + if (!c.compare || !sameDataRef) { + this.layout(); + didLayout = true; + } + } + if (!didLayout && props.setup) { + const { camera } = props.setup; + if (camera !== "hold") { + if (!deepCompare(this.viewer.setup.camera, camera)) { + if (!camera) (_b = (_a = this.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 || _b.homeCamera(); + else this.viewer.setCamera(camera); + const setup = clone(this.viewer.setup); + setup.camera = camera; + this.viewer.setup = setup; + } + } + if (props.setup.renderer) (_e = (_d = (_c = this.viewer) === null || _c === void 0 ? void 0 : _c.presenter) === null || _d === void 0 ? void 0 : _d.morphchartsref) === null || _e === void 0 || _e.setMorphChartsRendererOptions(props.setup.renderer); + } + } + componentDidMount() { + const { props } = this; + const element = base$2.reactDOM.findDOMNode(this.viewerDiv); + this.viewer = new Viewer$1(element, props.viewerOptions); + if (props.onMount) { + if (props.onMount(this.viewer.presenter.getElement(PresenterElement$1.gl))) this.view(); + } else this.view(); + } + componentDidUpdate() { + const { props } = this; + this.viewer.options = deepMerge(this.viewer.options, props.viewerOptions); + this.view(); + } + componentWillUnmount() { + this.viewer.finalize(); + } + render() { + return base$2.react.createElement("div", { + className: "sanddance-ReactViewer", + ref: (div) => this.viewerDiv = div + }); + } + } + return new __Viewer(_props); + } + var Viewer = _Viewer; + //#endregion + //#region ../sanddance-react/dist/es6/version.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var version$3 = "4.0.2"; + //#endregion + //#region ../sanddance-react/dist/es6/index.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var es6_exports$1 = /* @__PURE__ */ __exportAll({ + SandDance: () => es6_exports$2, + Viewer: () => Viewer, + use: () => use$3, + util: () => util_exports, + version: () => version$3 + }); + //#endregion + //#region ../sanddance-explorer/dist/es6/language.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function escapeHtml(value) { + return value.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); + } + var strings$1 = { + appName: "SandDance", + bingsearch: "Bing", + bingsearchDescription: (term) => `Search Bing for "${term}"`, + buttonClose: "Close", + buttonSelect: "Search & Select", + buttonColorSchemeMap: "Map color scheme to filtered data", + buttonColorSchemeRemap: "Remap color to filtered data", + buttonColorSchemeKeep: "Keep same color scheme", + buttonCopyToClipboard: "Copy to clipboard", + buttonExclude: "Exclude", + buttonExport: "Export", + buttonExportCount: (total) => total == 1 ? "Export 1 row..." : `Export ${total} rows...`, + buttonIsolate: "Isolate", + buttonReset: "Stop filtering", + buttonDeselect: "Clear selection", + buttonToolbarFloat: "Float toolbar", + buttonToolbarDock: "Dock toolbar", + buttonToolbarHide: "Hide toolbar", + buttonToolbarShow: "Show toolbar", + buttonNextDataItem: "Next data item", + buttonPrevDataItem: "Previous data item", + buttonCreateSnapshot: "Create snapshot", + buttonNextSnapshot: "Next snapshot", + buttonPrevSnapshot: "Previous snapshot", + buttonUpdateSnapshot: "Update snapshot", + buttonAddExpression: "Add expression", + buttonAddExpressionGroup: "Add group", + buttonDeleteExpression: "Delete", + buttonDeleteExpressionGroup: "Delete group", + buttonClearSnapshots: "Clear snapshots", + buttonDeleteSnapshot: "Delete snapshot", + buttonEditSnapshot: "Edit snapshot", + buttonMoveUp: "Move up", + buttonMoveDown: "Move down", + buttonShowVegaSpec: "Show Vega spec", + buttonLaunchVegaEditor: "Open Vega Editor", + buttonCameraHome: "Center chart in window", + buttonTooltipMapping: "Tooltip columns...", + buttonBackgroundImage: "Background image...", + buttonTransitionReverse: "Play Reverse", + buttonTransitionPause: "Pause", + buttonTransitionPlay: "Play", + buttonUndo: "Undo", + buttonRedo: "Redo", + buttonColumnTypes: "Column types...", + buttonApply: "Apply", + buttonRemove: "Remove", + buttonResetToDefault: "Reset to default", + chartTypeBarChartH: "Bar", + chartTypeBarChartV: "Column", + chartTypeDensity: "Density", + chartTypeGrid: "Grid", + chartTypeScatterPlot: "Scatter", + chartTypeStacks: "Stacks", + chartTypeStrips: "Strips", + chartTypeTreeMap: "Treemap", + defaultFileName: "sanddance-data", + errorExportFilenameEmpty: "Filename cannot be blank", + errorExportFilenameCharacters: (characters) => `A filename cannot contain any of the following characters: ${characters}`, + errorColumnMustBeNumeric: "Numeric column required for this chart type.", + errorNumericValue: "Value must be numeric", + errorImageFormat: "File is not an image", + labelBackgroundImageDialogTitle: "Background image", + labelBackgroundImageSubtext: "Background image can only be shown on Scatterplot, Density, and Stacks charts. Columns must be numeric type.", + labelBackgroundLeft: "Left extent", + labelBackgroundRight: "Right extent", + labelBackgroundBottom: "Bottom extent", + labelBackgroundTop: "Top extent", + labelBlank: "blank", + labelNull: "null", + labelTrue: "true", + labelFalse: "false", + labelSystemInfo: "System info", + labelChangeColumnType: "Change column type", + labelChartSettings: "Chart settings", + labelEditColumn: "Edit", + labelColumnName: "Column name", + labelColumnType: "Column type", + labelColumnDistinct: "Distinct values", + labelColumnHasColorData: "Has color data", + labelColumnIsColorData: "Is color data", + labelColumnQuantitativeMin: "Min", + labelColumnQuantitativeMax: "Max", + labelColumnQuantitativeMean: "Mean", + labelDataBrowser: "Data browser", + labelDataScope: "Scope", + labelExport: "Export Data", + labelExportFormat: "File format", + labelExportCSV: ".CSV - Comma separated values", + labelExportHTML: ".HTML - A SandDance html page embedding this data", + labelExportJSON: ".JSON - JavaScript object notation", + labelExportTSV: ".TSV - Tab separated values", + labelHistory: "History", + labelHistoryWarning: "This will erase your current history.", + labelTools: "Tools", + labelHoldCamera: "Keep previous camera position", + labelVegaSpec: "Vega specification", + labelColor: "Chart color", + labelError: "Error", + labelExportFileName: "File name", + labelSnapshots: "Snapshots", + labelSnapshotSettingThumbnailWidth: "Thumbnail image width", + labelSearch: "Select by search", + labelSearchClause: "Clause", + labelSearchColumn: "Field", + labelSearchOperator: "Operator", + labelSearchValue: "Value", + labelSearchValuePlaceholder: "Value to search for", + labelChart: "Chart", + labelChartCanvas: "Chart canvas", + labelColumnMapping: "Column Mapping", + labelChartTypeOptions: "Chart options", + labelColorBin: "Color binning", + labelColorOptions: "Color options", + labelColorBinExplanation: "For numeric columns", + labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount) => `Field ${escapeHtml(colorColumnName)} is of type ${escapeHtml(colorColumnType)}${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ""}.`, + labelColorFieldIsColorData: (colorColumnName) => `Field ${escapeHtml(colorColumnName)} contains direct color data.`, + labelColorBinNone: "None (continuous)", + labelColorBinQuantize: "Quantize", + labelColorBinQuantile: "Quantile", + labelColorFilter: "Note: Colors will be re-mapped to the filter when viewing this snapshot.", + labelColorScheme: "Scheme", + labelTotal: "Total by", + labelTotalByCountSquare: "Count (Grid layout)", + labelTotalByCountStrip: "Count (Strip layout)", + labelTotalBySumStrip: "Sum (Strip layout)", + labelTotalBySumTreemap: "Sum (Treemap layout)", + labelTotalBySumStripPercent: "Sum as percentage (Strip layout)", + labelColumnColor: "Color by", + labelColumnFacet: "Facet by", + labelFacetLayout: "Facet layout", + labelFacetLayoutWrap: "Wrap", + labelFacetLayoutCross: "⊞", + labelColumnFacetV: "Cross facet by", + labelColumnSort: "Sort by", + labelColumnX: "X Axis", + labelColumnY: "Y Axis", + labelColumnZ: "Z Axis", + labelColumnSize: "Size by", + labelColumnGroup: "Group by", + labelAliasColor: "Color", + labelAliasFacet: "Facet", + labelAliasFacetV: "Vertical facet", + labelAliasSort: "Sort", + labelAliasX: "X Axis", + labelAliasY: "Y Axis", + labelAliasZ: "Z Axis", + labelAliasSize: "Size", + labelAliasGroup: "Group", + labelDataItemIsFiltered: "Item is filtered from view", + labelHistoryInit: "Initial view", + labelHistoryFilterClear: "Clear filter", + labelHistoryFilterIExclude: "Exclude filter", + labelHistoryFilterIsolate: "Isolate filter", + labelHistoryChangeChartType: (chart) => `Change chart type to ${chart}`, + labelHistoryMapColumn: (column) => `Map ${column} role`, + labelHistoryUnMapColumn: (column) => `Unmap ${column} role`, + labelHistoryReviveSnapshot: "Revive snapshot", + labelHistoryColorBin: "Change color binning", + labelHistoryDirectColor: "Change direct color", + labelRenderer: "Renderer quality", + labelRendererAdvancedDisabled: "Renderer quality (Enhanced 3D mode not supported on this device)", + labelRendererBasic: "Standard mode", + labelRendererAdvanced: "Enhanced 3D mode", + labelRendererOptions: "Renderer options ...", + labelRendererOptionsDialogTitle: "Renderer options", + labelRendererOptionsAntialias: "Antialias", + labelRendererOptionsBloom: "Bloom highlighting (for selections)", + labelRendererOptionsBloomIntensity: "Intensity", + labelRendererOptionsDof: "Depth of Field", + labelRendererOptionsDofRange: "Focus Range", + labelRendererOptionsFxaa: "Antialias", + labelRendererOptionsShadow: "Shadows", + labelRendererOptionsSsao: "Screen Space Ambient Occlusion", + labelShowLegend: "Show legend", + labelShowAxes: "Show axes", + labelSnapshotTitle: "Title", + labelSnapshotDescription: "Note (optional)", + labelTooltipMapping: "Tooltip columns", + labelTransition: "Transition", + labelTransitionOptions: "Transition options", + labelTransitionScrubber: "Scrub transition", + labelTransitionStaggerBy: "Stagger by", + labelTransitionStaggerByOrdinal: "Data order", + labelTransitionStaggerByColumn: "Column", + labelTransitionStaggerByPosition: "Axis position", + labelTransitionStaggerOptions: "Stagger options", + labelTransitionStaggerReverse: "Reverse", + labelTransitionDurations: "Transition durations", + labelTransitionCamera: "2D / 3D view", + labelTransitionDuration: "Duration", + labelTransitionStagger: "Stagger", + labelVegaSpecData: "Data reference", + labelVegaSpecNotes: "Note: You may need to change the color scheme to make this visible in Vega.", + labelYes: "Yes", + labelNo: "No", + labelConfirmation: "Are you sure?", + labelColumnTypes: "Column types", + loading: "Loading...", + schemeCategorical: "Categorical", + schemeCyclical: "Cyclical", + schemeDiverging: "Diverging", + schemeDual: "Dual", + schemeSequentialMultiHue: "Sequential Multi Hue", + schemeSequentialMultiHueDark: "For dark backgrounds", + schemeSequentialMultiHueLight: "For light backgrounds", + schemeSequentialSingleHue: "Sequential Single Hue", + selectDataSpanAll: "All rows", + selectDataSpanFilter: "Filtered", + selectDataSpanSelection: "Selected", + selectVegaSpecDataNone: "None", + selectVegaSpecDataInline: "Inline - WARNING this may use substantial browser/clipboard memory for large data sets.", + selectVegaSpecDataUrl: "URL", + record: (current, total) => `${current} of ${total}`, + searchEQ: "=", + searchNEQ: "<>", + searchGT: ">", + searchGTE: ">=", + searchLT: "<", + searchLTE: "<=", + searchNULL: "is null or empty", + searchIN: "contains", + searchSW: "starts with", + searchWHERE: "Where", + searchAND: "and", + searchOR: "or", + selectAny: "-- any --", + selectNone: "-- none --", + selectNumeric: "Numeric", + selectNonNumeric: "Categorical", + selectDirectColor: "Direct color", + selectReference: "Column mappings", + tooltipSearch: (column, value) => `Click to search in '${column}' for "${value}"`, + labelRequired: "required", + labelSystem: "System", + labelViewType2d: "View in 2D", + labelViewType3d: "View in 3D", + labelDataColors: "Enabled if this data column contains any CSS color values.", + labelDataNullAll: "Loading data...", + labelDataNullFiltered: "You can filter by first making a selection, then choosing Isolate or Exclude in the top bar.", + labelDataNullSelection: "You can select by:
    • clicking the chart axes
    • clicking in the legend
    • searching", + labelZeroAll: "Dataset contains zero rows.", + labelZeroSearchResults: "No rows matched your search.", + signalGroups: [ + { + prefix: "Chart", + label: "Chart options" + }, + { + prefix: "Mark", + label: "Mark options" + }, + { + prefix: "RoleColor", + label: "Color options" + }, + { + prefix: "RoleFacet", + label: "Facet options" + }, + { + prefix: "RoleSort", + label: "Sort options" + }, + { + prefix: "RoleX", + label: "X axis options" + }, + { + prefix: "RoleY", + label: "Y axis options" + }, + { + prefix: "RoleZ", + label: "Z axis options" + }, + { + prefix: "Text", + label: "Text options" + }, + { + prefix: "*", + label: "Options" + } + ], + percentValueFormat: (value) => `${value}%` + }; + //#endregion + //#region ../sanddance-explorer/dist/es6/controls/iconButton.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function IconButton$1(props) { + return base$1.react.createElement(base$1.fluentUI.IconButton, Object.assign({}, props, { + styles: props.styles || { + root: { color: props.themePalette.black }, + rootHovered: { + background: "transparent", + color: props.themePalette.themePrimary + }, + rootPressed: { background: "transparent" }, + menuIcon: { display: "none" } + }, + iconProps: { iconName: props.iconName }, + menuProps: props.menuProps + })); + } + //#endregion + //#region ../chart-recommender/dist/es6/recommender.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function defaultColorScheme$1(c) { + if (c.quantitative) return "redyellowgreen"; + else if (c.stats.distinctValueCount === 2) return "dual_redgreen"; + else if (c.stats.distinctValueCount <= 10) return "category10"; + return "category20"; + } + //#endregion + //#region ../chart-recommender/dist/es6/barChart.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var maxDistinctVal = 20; + var minDistinctVal = 2; + var BarChartRecommenderSummary = class { + constructor(columns, data) { + let score = -1; + for (let i = 0; i < columns.length; i++) { + const recommendation = new BarChartRecommender(columns[i], data).recommend(); + if (recommendation.score > score) { + this.best = recommendation; + score = recommendation.score; + } + if (score === 1) break; + } + for (let k = 0; k < columns.length; k++) { + const column = columns[k]; + if (column.name === this.best.columns.x || column.stats.isSequential) continue; + if (column.quantitative || column.stats.distinctValueCount < 20 && column.stats.distinctValueCount > 1) { + this.best.columns.color = this.best.columns.sort = column.name; + this.best.scheme = defaultColorScheme$1(column); + if (column.quantitative) this.best.colorBin = "quantile"; + break; + } + } + } + recommend() { + return this.best; + } + }; + var BarChartRecommender = class { + constructor(column, data) { + this.score = 0; + this.column = column; + this.rules = [(column) => { + if (column.stats.isSequential) return false; + else if (column.quantitative) return true; + else if (!column.quantitative && column.stats.distinctValueCount <= maxDistinctVal && column.stats.distinctValueCount >= minDistinctVal) return true; + else return false; + }]; + for (let i = 0; i < this.rules.length; i++) if (this.rules[i](column)) this.score++; + } + recommend() { + return { + chart: "barchart", + columns: { x: this.column.name }, + score: this.score, + scheme: void 0, + view: "2d" + }; + } + }; + //#endregion + //#region ../chart-recommender/dist/es6/geo.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var longitudeNames = [ + "lon", + "long", + "longitude" + ]; + var latitudeNames = ["lat", "latitude"]; + function isSpec(names, limits, column, data) { + let is = false; + const cname = column.name.toLowerCase(); + for (let i = 0; i < names.length; i++) if (names[i] === cname) { + is = true; + break; + } + if (data) {} + return is; + } + function isLongitude(column, data) { + return isSpec(longitudeNames, [-180, 180], column, data); + } + function isLatitude(column, data) { + return isSpec(latitudeNames, [-90, 90], column, data); + } + function isGeo(column, data) { + return isLatitude(column, data) || isLongitude(column, data); + } + //#endregion + //#region ../chart-recommender/dist/es6/scatterPlot.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var ScatterPlotRecommenderSummary = class { + constructor(columns, data) { + const rec = { + chart: "scatterplot", + score: void 0, + columns: {}, + scheme: void 0, + view: "2d" + }; + columns.forEach((column) => { + if (!rec.columns.x) { + if (column.name.toLowerCase() === "x") return rec.columns.x = column.name; + else if (isLongitude(column)) return rec.columns.x = column.name; + } + if (!rec.columns.y) { + if (column.name.toLowerCase() === "y") return rec.columns.y = column.name; + else if (isLatitude(column)) return rec.columns.y = column.name; + } + if (!rec.columns.color && !column.stats.isSequential) { + if (column.quantitative || column.stats.distinctValueCount < 20) { + rec.columns.color = rec.columns.sort = column.name; + rec.scheme = defaultColorScheme$1(column); + if (column.quantitative) rec.colorBin = "quantile"; + return; + } + } + }); + if (rec.columns.x && rec.columns.y) this.best = rec; + } + recommend() { + return this.best; + } + }; + //#endregion + //#region ../chart-recommender/dist/es6/treemap.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function preferredColumnForTreemapSize(columns, strict) { + for (let i = 0; i < columns.length; i++) { + const c = columns[i]; + if (c.quantitative) { + if (strict && c.stats.hasNegative) continue; + if (strict && c.stats.isSequential) continue; + if (strict && isGeo(c)) continue; + return c; + } + } + } + //#endregion + //#region ../chart-recommender/dist/es6/recommenderSummary.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var RecommenderSummary = class { + constructor(columns, data) { + const quickRec = new ScatterPlotRecommenderSummary(columns, data).recommend(); + if (quickRec) this.rec = quickRec; + else { + const barChartrec = new BarChartRecommenderSummary(columns, data).recommend(); + if (barChartrec && barChartrec.score >= 1) this.rec = barChartrec; + else this.rec = { + chart: "grid", + columns: {}, + score: 1 + }; + } + } + recommend() { + return this.rec; + } + }; + //#endregion + //#region ../sanddance-explorer/dist/es6/columns.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function ensureColumnsExist(insightColumns, actualColumns, transform) { + for (const role in insightColumns) { + const columnName = insightColumns[role]; + const column = actualColumns.filter((c) => c.name === columnName)[0]; + const transformColumn = transform ? transform.filter((t) => { + switch (t.type) { + case "formula": return t.as === columnName; + } + })[0] : null; + if (!(column || transformColumn)) delete insightColumns[role]; + } + } + function ensureColumnsPopulated(chart, totalStyle, insightColumns, actualColumns) { + const nonInternal = actualColumns.filter((c) => !isInternalFieldName(c.name)); + const firstColumn = nonInternal[0]; + const firstColumnName = firstColumn && firstColumn.name; + const firstQuantitative = nonInternal.filter((c) => c.quantitative)[0]; + const firstQuantitativeColumnName = firstQuantitative && firstQuantitative.name; + const ensureColumn = (role, quantitative, treemap) => { + if (!insightColumns[role]) if (treemap) insightColumns[role] = getTreemapColumn(actualColumns).name; + else insightColumns[role] = quantitative ? firstQuantitativeColumnName : firstColumnName; + }; + function checkRequiresSize() { + switch (totalStyle) { + case "sum-strip": + case "sum-strip-percent": + ensureColumn("size", true); + break; + case "sum-treemap": + ensureColumn("size", true, true); + break; + } + } + switch (chart) { + case "barchart": + case "barchartV": + ensureColumn("x"); + checkRequiresSize(); + break; + case "barchartH": + ensureColumn("y"); + checkRequiresSize(); + break; + case "density": + ensureColumn("x"); + ensureColumn("y"); + checkRequiresSize(); + break; + case "scatterplot": + case "stacks": + ensureColumn("x"); + ensureColumn("y"); + break; + case "treemap": + if (!insightColumns.size) insightColumns.size = getTreemapColumn(actualColumns).name; + if (!insightColumns.size) return [strings$1.errorColumnMustBeNumeric]; + break; + } + } + function getTreemapColumn(columns) { + let column = preferredColumnForTreemapSize(columns, true); + if (!column) column = preferredColumnForTreemapSize(columns, false); + return column; + } + function colorMapping(insight, columns) { + if (columns && insight.columns && insight.columns.color) return columns.filter((c) => c.name === insight.columns.color)[0]; + } + function getBackgroundImageColumnBounds(columns) { + const bounds = []; + const getBound = (dimension, dataExtent, column) => { + const { stats } = column; + const numericValue = dataExtent === "max" ? stats.max : stats.min; + return { + columnName: column.name, + dimension, + valid: true, + dataExtent, + numericValue, + stringValue: numericValue.toString() + }; + }; + const dataExtents = ["max", "min"]; + const dimensions = ["x", "y"]; + columns.forEach((c) => { + if (c.quantitative) dimensions.forEach((dimension) => dataExtents.forEach((dataExtent) => bounds.push(getBound(dimension, dataExtent, c)))); + }); + return bounds; + } + //#endregion + //#region ../sanddance-explorer/dist/es6/dialogs/backgroundImageEditor.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function _BackgroundImageEditor(_props) { + class __BackgroundImageEditor extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + backgroundImageColumnBounds: [], + readyToApply: false, + hidden: true + }; + } + show(insightColumns) { + const { explorer, quantitativeColumns } = this.props; + if (!quantitativeColumns.length) return; + const xCol = quantitativeColumns.filter((c) => c.name === insightColumns.x)[0]; + const yCol = quantitativeColumns.filter((c) => c.name === insightColumns.y)[0]; + let backgroundImageColumnBounds; + if (explorer.imageHolder.backgroundImageColumnBounds.length < quantitativeColumns.length * 4) backgroundImageColumnBounds = getBackgroundImageColumnBounds(explorer.state.dataContent.columns); + else backgroundImageColumnBounds = clone(explorer.imageHolder.backgroundImageColumnBounds); + const newState = { + hidden: false, + xCol, + yCol, + backgroundImageColumnBounds + }; + if (!xCol || !yCol) {} + this.setState(newState); + this.checkReady(); + } + render() { + const { props, state } = this; + const { explorer } = props; + return base$1.react.createElement(Dialog$1, { + hidden: state.hidden, + onDismiss: () => this.setState({ + hidden: true, + backgroundImageFileFormatError: null + }), + modalProps: { containerClassName: "sanddance-background-image-dialog" }, + dialogContentProps: { + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelBackgroundImageDialogTitle, + subText: strings$1.labelBackgroundImageSubtext + }, + buttons: [base$1.react.createElement(base$1.fluentUI.PrimaryButton, { + key: "apply", + iconProps: { iconName: "Photo2Add" }, + text: strings$1.buttonApply, + onClick: () => this.applyImage(true), + disabled: !state.readyToApply + })] + }, explorer.imageHolder.img ? base$1.react.createElement("div", { className: "thumbnail" }, base$1.react.createElement("img", { src: explorer.imageHolder.img.src }), base$1.react.createElement(base$1.fluentUI.DefaultButton, { + key: "remove", + iconProps: { iconName: "Photo2Remove" }, + text: strings$1.buttonRemove, + onClick: () => { + explorer.imageHolder.img = null; + this.applyImage(false); + this.setState({ readyToApply: false }); + } + })) : base$1.react.createElement("div", { className: "thumbnail" }, base$1.react.createElement("input", { + type: "file", + onChange: (e) => this.readBackgroundImage(e) + }), state.backgroundImageFileFormatError && base$1.react.createElement("div", { className: "error" }, state.backgroundImageFileFormatError)), this.inputForColumn(state.xCol, "X axis", "x", strings$1.labelBackgroundLeft, strings$1.labelBackgroundRight), this.inputForColumn(state.yCol, "Y axis", "y", strings$1.labelBackgroundBottom, strings$1.labelBackgroundTop)); + } + inputForColumn(column, label, dimension, minLabel, maxLabel) { + const { props, state } = this; + const fieldInput = (label, dataExtent, getDefault) => { + const bounds = state.backgroundImageColumnBounds.filter((b) => b.columnName === (column === null || column === void 0 ? void 0 : column.name) && b.dimension === dimension && b.dataExtent === dataExtent)[0]; + if (!bounds) return null; + return base$1.react.createElement("div", { className: "axis-bound-field" }, base$1.react.createElement(base$1.fluentUI.TextField, { + label, + onChange: (e, value) => { + const numericValue = +value; + bounds.stringValue = value; + bounds.valid = !(!value || isNaN(numericValue)); + if (bounds.valid) bounds.numericValue = numericValue; + this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); + this.checkReady(); + }, + value: bounds.stringValue, + errorMessage: bounds.valid ? null : strings$1.errorNumericValue, + onRenderSuffix: (a) => { + return base$1.react.createElement(IconButton$1, { + iconName: "ScaleVolume", + themePalette: props.themePalette, + title: "Use data extent", + onClick: () => { + bounds.numericValue = getDefault(); + bounds.stringValue = bounds.numericValue.toString(); + bounds.valid = true; + this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); + this.checkReady(); + } + }); + } + })); + }; + return base$1.react.createElement("div", { className: "axis-bounds" }, base$1.react.createElement(base$1.fluentUI.Dropdown, { + label, + options: props.quantitativeColumns.map((c) => { + return { + key: c.name, + text: c.name + }; + }), + onChange: (e, o) => { + const newState = { readyToApply: false }; + const newColumn = props.quantitativeColumns.filter((c) => c.name === o.key)[0]; + switch (dimension) { + case "x": + newState.xCol = newColumn; + break; + case "y": + newState.yCol = newColumn; + break; + } + this.setState(newState); + this.checkReady(); + }, + selectedKey: column === null || column === void 0 ? void 0 : column.name + }), base$1.react.createElement("div", { className: "axis-bound-fields" }, fieldInput(minLabel, "min", () => column.stats.min), fieldInput(maxLabel, "max", () => column.stats.max))); + } + readBackgroundImage(e) { + if (e.target.files) { + const file = e.target.files[0]; + const reader = new FileReader(); + reader.onload = () => { + const img = new Image(); + img.onerror = () => { + this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); + }; + img.onload = () => { + const { src, height, width } = img; + this.props.explorer.imageHolder.img = { + src, + height, + width + }; + this.checkReady(); + }; + try { + img.src = reader.result; + } catch (e) { + this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); + } + }; + reader.readAsDataURL(file); + } + } + checkReady() { + setTimeout(() => { + const { state, props } = this; + const { explorer } = props; + const { backgroundImageColumnBounds } = state; + let valid = true; + const dimensions = ["x", "y"]; + const dataExtents = ["max", "min"]; + [state.xCol, state.yCol].forEach((c) => dimensions.forEach((dimension) => dataExtents.forEach((dataExtent) => { + if (!backgroundImageColumnBounds.filter((b) => b.columnName === c.name && b.dataExtent === dataExtent && b.dimension === dimension)[0].valid) valid = false; + }))); + const readyToApply = explorer.imageHolder.img && valid; + this.setState({ readyToApply }); + }, 0); + } + applyImage(showBackgroundImage) { + const { props, state } = this; + const { explorer } = props; + explorer.imageHolder.showBackgroundImage = showBackgroundImage; + explorer.imageHolder.backgroundImageColumnBounds = clone(state.backgroundImageColumnBounds); + if (showBackgroundImage) switch (props.chart) { + case "density": + case "scatterplot": + case "stacks": break; + default: + explorer.changeChartType("scatterplot"); + return; + } + explorer.forceUpdate(); + } + } + return new __BackgroundImageEditor(_props); + } + var BackgroundImageEditor = _BackgroundImageEditor; + function setInsightBackgroundImage(insight, imageHolder, columns) { + if (!imageHolder.showBackgroundImage || !columns.x || !columns.y) return; + const { backgroundImageColumnBounds } = imageHolder; + const xBounds = backgroundImageColumnBounds.filter((b) => b.columnName === columns.x && b.dimension === "x"); + const yBounds = backgroundImageColumnBounds.filter((b) => b.columnName === columns.y && b.dimension === "y"); + if (!xBounds.length || !yBounds.length) return; + const allBounds = [...xBounds, ...yBounds]; + for (let i = 0; i < allBounds.length; i++) if (!allBounds[i].valid) return; + const bottom = yBounds.filter((b) => b.dataExtent === "min")[0]; + const left = xBounds.filter((b) => b.dataExtent === "min")[0]; + const right = xBounds.filter((b) => b.dataExtent === "max")[0]; + const top = yBounds.filter((b) => b.dataExtent === "max")[0]; + const all = [ + bottom, + left, + right, + top + ]; + for (let i = 0; i < all.length; i++) if (!all[i]) return; + const { src, height, width } = imageHolder.img; + insight.backgroundImage = { + url: src, + size: { + height, + width + }, + extents: { + bottom: bottom.numericValue, + left: left.numericValue, + right: right.numericValue, + top: top.numericValue + } + }; + insight.size = insight.backgroundImage.size; + } + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function Dropdown$1(props) { + const newProps = Object.assign({}, props); + let selectedKey = null; + if (newProps.options && newProps.options.length > 1) { + const selectedOptions = newProps.options.filter((option) => option.selected); + if (selectedOptions && selectedOptions.length > 0) selectedKey = selectedOptions[0].key; + } + if (newProps.collapseLabel) newProps.onRenderTitle = ((a, b) => { + return base$1.react.createElement("span", null, newProps.label, ": ", a[0].text); + }); + return base$1.react.createElement(base$1.fluentUI.Dropdown, Object.assign({ dropdownWidth: 200 }, newProps, { + label: newProps.collapseLabel ? null : newProps.label, + selectedKey + })); + } + //#endregion + //#region ../sanddance-explorer/dist/es6/controls/signal.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getInitialSignalValue(explorer, signal) { + let initialValue; + try { + initialValue = explorer.viewer.vegaViewGl.signal(signal.name); + } catch (error) {} + return initialValue; + } + function Signal(props) { + if (!props.explorer.viewer || !props.signal) return null; + if (props.signal.bind) { + const input = props.signal.bind.input; + if (input) { + const fn = map$2[input]; + if (fn) { + const control = fn(props.prefix ? `${props.prefix} ` : "", props.signal.bind, props.initialValue, (value) => { + props.onChange && props.onChange(value); + props.explorer.signal(props.signal.name, value, props.newViewStateTarget); + }, props.disabled, props.collapseLabel, props.componentRef); + return base$1.react.createElement("div", { className: "sanddance-signal" }, control); + } + } + } + return null; + } + var map$2 = {}; + map$2["range"] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref) => { + let debouncer; + return base$1.react.createElement(base$1.fluentUI.Slider, { + componentRef: ref, + label: prefix + bind.name, + max: bind.max, + min: bind.min, + step: bind.step, + defaultValue: initialValue, + onChange: (value) => { + if (debouncer) clearTimeout(debouncer); + debouncer = setTimeout(() => onChange(value), bind.debounce || 0); + }, + disabled + }); + }; + map$2["select"] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref) => { + const options = bind.options.map((o, i) => { + return { + key: o, + text: o + }; + }); + const label = prefix + bind.name; + return base$1.react.createElement(base$1.fluentUI.Dropdown, { + componentRef: ref, + onRenderTitle: collapseLabel ? ((a, b) => base$1.react.createElement("span", null, label, ": ", a[0].text)) : void 0, + defaultSelectedKey: initialValue, + label: collapseLabel ? void 0 : label, + options, + onChange: (e, o) => onChange(o.text), + disabled + }); + }; + map$2["checkbox"] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref) => { + return base$1.react.createElement(base$1.fluentUI.Toggle, { + componentRef: ref, + defaultChecked: initialValue, + label: prefix + bind.name, + onChange: (e, checked) => onChange(checked), + disabled + }); + }; + //#endregion + //#region ../sanddance-explorer/dist/es6/controls/columnMap.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var maxFacets = 50; + var roleLabels = { + color: strings$1.labelColumnColor, + facet: strings$1.labelColumnFacet, + facetV: strings$1.labelColumnFacetV, + group: strings$1.labelColumnGroup, + size: strings$1.labelColumnSize, + sort: strings$1.labelColumnSort, + uid: null, + x: strings$1.labelColumnX, + y: strings$1.labelColumnY, + z: strings$1.labelColumnZ + }; + var aliasLabels = { + color: strings$1.labelAliasColor, + facet: strings$1.labelAliasFacet, + facetV: strings$1.labelAliasFacetV, + group: strings$1.labelAliasGroup, + size: strings$1.labelAliasSize, + sort: strings$1.labelAliasSort, + uid: null, + x: strings$1.labelAliasX, + y: strings$1.labelAliasY, + z: strings$1.labelAliasZ + }; + function filterColumnList(context, columns) { + switch (context) { + case "facet": + case "facetV": return columns.filter((column) => column.quantitative || column.stats.distinctValueCount && column.stats.distinctValueCount < maxFacets); + default: return columns.slice(); + } + } + function optionsForSpecColumn(sectionName, columns, role, disabledColumnName, selectedColumnName) { + const options = filterColumnList(role, columns).map((column) => { + return { + key: `column:${column.name}`, + text: column.name, + data: column, + selected: selectedColumnName === column.name, + disabled: disabledColumnName === column.name + }; + }); + if (options.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options.unshift(option); + } + return options; + } + function optionsForReference(sectionName, specRoles) { + const options = specRoles.map((specRole) => { + return { + key: `role:${specRole.role}`, + text: aliasLabels[specRole.role], + data: specRole.role + }; + }).sort((a, b) => a.text.localeCompare(b.text)); + if (options.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options.unshift(option); + } + return options; + } + function selectFirst(options) { + for (let i = 0; i < options.length; i++) { + if (options[i].itemType === base$1.fluentUI.DropdownMenuItemType.Header) continue; + options[i].selected = true; + return; + } + } + function getColumnMapOptions(props) { + if (!props.specRole) return null; + let categoricalColumns; + let directColorColumns; + let directColorGroup; + let referenceGroup = []; + if (props.specRole.role === "color") { + categoricalColumns = props.categoricalColumns.filter((c) => !c.isColorData); + directColorColumns = props.categoricalColumns.filter((c) => c.isColorData); + directColorGroup = optionsForSpecColumn(strings$1.selectDirectColor, directColorColumns, "color", props.disabledColumnName, props.selectedColumnName); + } else categoricalColumns = props.categoricalColumns; + if (props.specRole.role === "sort") { + const others = props.specCapabilities.roles.filter((specRole) => specRole.role !== props.specRole.role); + referenceGroup = optionsForReference(strings$1.selectReference, others); + } + const quantitativeGroup = optionsForSpecColumn(strings$1.selectNumeric, props.quantitativeColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); + const categoricGroup = props.specRole.excludeCategoric ? null : optionsForSpecColumn(strings$1.selectNonNumeric, categoricalColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); + return referenceGroup.concat(quantitativeGroup).concat(categoricGroup).concat(directColorGroup).filter(Boolean); + } + function ColumnMap(props) { + const options = getColumnMapOptions(props); + if (props.specRole.allowNone) options.unshift({ + key: -1, + text: strings$1.selectNone + }); + if (!options.reduce((p, c) => { + return p || c.selected; + }, false)) selectFirst(options); + let signals; + if (props.explorer.viewer && props.explorer.viewer.vegaSpec) { + if (props.specRole.signals) signals = props.explorer.viewer.vegaSpec.signals.filter((s) => props.specRole.signals.indexOf(s.name) >= 0); + } + const label = roleLabels[props.specRole.role]; + const signalElements = !props.hideSignals && signals && signals.map((signal, i) => { + let initialValue; + try { + initialValue = props.explorer.viewer.vegaViewGl.signal(signal.name); + } catch (error) {} + return base$1.react.createElement(Signal, { + key: signal.name + i + initialValue, + explorer: props.explorer, + signal, + initialValue, + onChange: (value) => props.onChangeSignal && props.onChangeSignal(signal.name, value), + collapseLabel: props.collapseLabel + }); + }); + return base$1.react.createElement("div", { className: "sanddance-columnMap" }, props.prefix, !props.hideDropdown && base$1.react.createElement(Dropdown$1, { + componentRef: props.componentRef, + collapseLabel: props.collapseLabel, + disabled: props.disabled, + label, + options, + onChange: (e, o) => props.changeColumnMapping(props.specRole.role, typeof o.data === "string" ? o.data : clone(o.data)), + onDismiss: props.onDismiss + }), signalElements, props.suffix); + } + //#endregion + //#region ../sanddance-explorer/dist/es6/clickableTextLayer.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function attachSpecRoleToAxisTitle(stage, specCapabilities) { + for (const axisName in stage.axes) specCapabilities.roles.forEach((specRole) => { + if (specRole.role === axisName) stage.axes[axisName].forEach((axis) => { + if (axis.title) { + const textItem = axis.title; + textItem.specRole = specRole; + } + }); + }); + } + function px$1(n) { + return n + "px"; + } + function _PositionedColumnMap(_props) { + class __PositionedColumnMap extends base$1.react.Component { + constructor(props) { + super(props); + const { left, top } = props; + this.state = { + left, + top + }; + this.dropdownRef = base$1.react.createRef(); + } + focus() { + if (!this.focused) { + this.focused = true; + this.dropdownRef.current.focus(true); + } + } + componentDidMount() { + const size = outerSize$1(this.div); + const over = { + left: Math.max(0, this.state.left + size.width - this.props.container.offsetWidth), + top: Math.max(0, this.state.top + size.height - this.props.container.offsetHeight) + }; + if (over.left || over.top) { + let { left, top } = this.state; + left -= over.left; + top -= over.top; + this.setState({ + left, + top + }); + } else this.focus(); + } + componentDidUpdate() { + this.focus(); + } + render() { + return base$1.react.createElement("div", { + ref: (div) => { + if (div) this.div = div; + }, + className: "sanddance-columnMap-absolute", + style: { + position: "absolute", + left: px$1(this.state.left), + top: px$1(this.state.top) + } + }, base$1.react.createElement(ColumnMap, Object.assign({}, this.props, { + componentRef: this.dropdownRef, + hideSignals: true + }))); + } + } + return new __PositionedColumnMap(_props); + } + var PositionedColumnMap = _PositionedColumnMap; + //#endregion + //#region ../sanddance-explorer/dist/es6/controls/columnTypeChanger.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function _ColumnTypeChanger(_props) { + class __ColumnTypeChanger extends base$1.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(); + } + getInitialState() { + const { props } = this; + return { + dialogHidden: true, + confirmationHidden: true, + quantitativeColumns: props.initialQuantitativeColumns.map((c) => clone(c)), + categoricalColumns: props.initialCategoricalColumns.map((c) => clone(c)), + columnTypes: null + }; + } + closeDialog() { + this.setState(this.getInitialState()); + } + openConfirmation(columnTypes) { + this.setState({ + columnTypes, + confirmationHidden: false + }); + } + render() { + const { props, state } = this; + const hasChanges = props.initialQuantitativeColumns.some((c, i) => { + return c.quantitative !== state.quantitativeColumns[i].quantitative; + }); + return base$1.react.createElement("div", null, base$1.react.createElement(base$1.fluentUI.DefaultButton, { + text: strings$1.buttonColumnTypes, + onClick: () => this.setState({ dialogHidden: false }) + }), base$1.react.createElement(Dialog$1, { + minWidth: "80%", + hidden: state.dialogHidden, + onDismiss: () => this.closeDialog(), + dialogContentProps: { + className: `sanddance-dialog ${props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelColumnTypes + }, + buttons: [base$1.react.createElement(base$1.fluentUI.DefaultButton, { + key: "revert", + text: strings$1.buttonResetToDefault, + onClick: () => this.openConfirmation(null), + iconProps: { iconName: "Undo" } + }), base$1.react.createElement(base$1.fluentUI.DefaultButton, { + key: "apply", + text: strings$1.buttonApply, + onClick: () => { + const columnTypes = {}; + state.quantitativeColumns.forEach((c) => { + columnTypes[c.name] = c.quantitative ? c.type : "string"; + }); + state.categoricalColumns.forEach((c) => { + columnTypes[c.name] = "string"; + }); + this.openConfirmation(columnTypes); + }, + iconProps: { iconName: "Accept" }, + disabled: !hasChanges + })] + }, base$1.react.createElement("div", { className: "sanddance-columnTypes" }, state.quantitativeColumns.length > 0 && base$1.react.createElement("div", null, base$1.react.createElement("h3", null, strings$1.selectNumeric), base$1.react.createElement("table", null, base$1.react.createElement("thead", null, base$1.react.createElement("tr", null, base$1.react.createElement("th", null, strings$1.labelEditColumn), base$1.react.createElement("th", null, strings$1.labelColumnName), base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMin), base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMax), base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMean), base$1.react.createElement("th", null, strings$1.labelColumnDistinct))), base$1.react.createElement("tbody", null, state.quantitativeColumns.map((c, i) => base$1.react.createElement("tr", { + key: i, + className: c.quantitative ? "" : "changed" + }, base$1.react.createElement("td", null, base$1.react.createElement(IconButton$1, { + iconName: "Edit", + onClick: void 0, + menuProps: { items: [strings$1.selectNumeric, strings$1.selectNonNumeric].map((t) => { + return { + key: t, + text: t, + onClick: () => { + c.quantitative = t === strings$1.selectNumeric; + this.setState({ quantitativeColumns: [...state.quantitativeColumns] }); + } + }; + }) }, + themePalette: props.themePalette, + title: strings$1.labelChangeColumnType + })), base$1.react.createElement("td", null, c.name), base$1.react.createElement("td", null, c.stats.min), base$1.react.createElement("td", null, c.stats.max), base$1.react.createElement("td", null, c.stats.mean), base$1.react.createElement("td", null, c.stats.distinctValueCount)))))), state.categoricalColumns.length > 0 && base$1.react.createElement("div", null, base$1.react.createElement("h3", null, strings$1.selectNonNumeric), base$1.react.createElement("table", null, base$1.react.createElement("thead", null, base$1.react.createElement("tr", null, base$1.react.createElement("th", null, strings$1.labelColumnName), base$1.react.createElement("th", null, strings$1.labelColumnType), base$1.react.createElement("th", null, strings$1.labelColumnDistinct), base$1.react.createElement("th", null, strings$1.labelColumnHasColorData), base$1.react.createElement("th", null, strings$1.labelColumnIsColorData))), base$1.react.createElement("tbody", null, state.categoricalColumns.map((c, i) => base$1.react.createElement("tr", { key: i }, base$1.react.createElement("td", null, c.name), base$1.react.createElement("td", null, c.type), base$1.react.createElement("td", null, c.stats.distinctValueCount), base$1.react.createElement("td", null, (!!c.stats.hasColorData).toString()), base$1.react.createElement("td", null, (!!c.isColorData).toString())))))))), base$1.react.createElement(Dialog$1, { + hidden: state.confirmationHidden, + onDismiss: () => this.setState({ confirmationHidden: true }), + dialogContentProps: { + className: `sanddance-dialog ${props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelConfirmation, + subText: strings$1.labelHistoryWarning + }, + buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { + text: strings$1.buttonApply, + onClick: () => { + this.closeDialog(); + this.props.onConfirmUpdate(this.state.columnTypes); + }, + iconProps: { iconName: "Accept" } + }) + })); + } + } + return new __ColumnTypeChanger(_props); + } + var ColumnTypeChanger = _ColumnTypeChanger; + //#endregion + //#region ../sanddance-explorer/dist/es6/controls/dataExporterHtml.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var embedHtml = (title, embed) => ` @@ -30067,2105 +33629,2197 @@ f 5/6/6 1/12/6 8/11/6`; ${embed} `; - function convertToDelimited(data2, delimiter) { - const fields = Object.keys(data2[0]); - const file = data2.map((row) => { - return fields.map((fieldName) => { - const value2 = row[fieldName]; - if (typeof value2 === "number") { - return value2; - } - if (typeof value2 === "string") { - if (value2.indexOf(delimiter) >= 0) { - return `"${value2.replace(/"/g, '""')}"`; - } else { - return value2; - } - } - return ""; - }).join(delimiter); - }); - file.unshift(fields.join(delimiter)); - return file.join("\n"); - } - const exportTypes = [ - ["json", strings$1.labelExportJSON], - ["csv", strings$1.labelExportCSV], - ["tsv", strings$1.labelExportTSV], - ["html", strings$1.labelExportHTML] - ]; - function _DataExportPicker(_props) { - class __DataExportPicker extends base$1.react.Component { - constructor(props) { - super(props); - this.state = this.getInitialState(this.props); - } - getInitialState(props) { - const initialState = { - initializer: props.initializer, - dialogHidden: true, - exportType: exportTypes[0][0], - fileName: props.initializer.fileName, - fileNameError: "", - working: false - }; - return initialState; - } - componentDidUpdate() { - if (!deepCompare(this.props.initializer, this.state.initializer)) { - this.setState(this.getInitialState(this.props)); - } - } - // Converts to dataExport type and calls dataExportHandler to deal with data - createExport(exportType, displayName) { - const final = (data2) => { - this.props.dataExportHandler(data2, exportType, displayName); - this.close(); - }; - const json2 = JSON.stringify(this.props.data, columnReplacer); - switch (exportType) { - case "json": { - final(json2); - break; - } - case "csv": { - final(convertToDelimited(JSON.parse(json2), ",")); - break; - } - case "tsv": { - final(convertToDelimited(JSON.parse(json2), " ")); - break; - } - case "html": { - const csv = convertToDelimited(JSON.parse(json2), ","); - const html = embedHtml(`${strings$1.appName} - ${escape(displayName)}`, embedScript(csv, displayName)); - final(html); - } - } - } - close() { - this.setState({ dialogHidden: true, working: false }); - } - render() { - const closeDialog = () => this.close(); - if (this.state.delayAction) { - requestAnimationFrame(() => { - if (this.state.delayAction) { - this.state.delayAction(); - this.setState({ delayAction: null }); - } - }); - } - const disabled = this.state.working || this.state.dialogHidden; - return base$1.react.createElement( - "div", - null, - base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "search-action search-bottom-action", text: strings$1.buttonExportCount(this.props.data.length), onClick: () => this.setState({ dialogHidden: false }), disabled: this.props.disabled }), - base$1.react.createElement( - Dialog$1, - { hidden: this.state.dialogHidden, onDismiss: closeDialog, dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: base$1.fluentUI.DialogType.normal, - title: strings$1.labelExport - }, buttons: [ - base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: 0, disabled: disabled || !!this.state.fileNameError, onClick: (e) => this.setState({ - delayAction: () => this.createExport(this.state.exportType, this.state.fileName), - working: true - }), text: strings$1.buttonExport, iconProps: { - iconName: "Download" - } }) - ] }, - base$1.react.createElement(base$1.fluentUI.TextField, { label: strings$1.labelExportFileName, onChange: (e, displayName) => { - const displayNameError = getFileNameError(displayName); - this.setState({ fileName: displayName, fileNameError: displayNameError }); - }, errorMessage: this.state.fileNameError, value: this.state.fileName }), - base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { className: "sanddance-form-separate", disabled, selectedKey: this.state.exportType, options: exportTypes.map(([exportType, text2]) => { - return { - key: exportType, - text: text2, - disabled: false - }; - }), onChange: (ev, option) => this.setState({ exportType: option.key }), label: strings$1.labelExportFormat }) - ) - ); - } - } - return new __DataExportPicker(_props); - } - const DataExportPicker = _DataExportPicker; - const illegalChars = '\\/:*?"<>|'; - function getFileNameError(displayName) { - if (!displayName) { - return strings$1.errorExportFilenameEmpty; - } - for (let i = 0; i < illegalChars.length; i++) { - if (displayName.indexOf(illegalChars[i]) >= 0) { - return strings$1.errorExportFilenameCharacters(illegalChars); - } - } - } - function removeExtensions(fileName) { - exportTypes.forEach(([exportType]) => { - const re2 = new RegExp(`\\.${exportType}`, "ig"); - fileName = fileName.replace(re2, ""); - }); - return fileName; - } - function columnReplacer(name, value2) { - if (isInternalFieldName(name, true)) { - return void 0; - } - return value2 === null ? "" : value2; - } - function embedScript(csv, displayName, snapshots) { - const dataFile = { type: "csv", displayName, snapshots }; - return ` - - - - - - - + `; -} -function $cff73bb5fafa0795$export$9f4b684ea6be1a90(data, displayName, snapshots) { - const json = JSON.stringify(data, $cff73bb5fafa0795$var$columnReplacer); - const csv = (0, $3a2778f19bd71931$export$65aea4b3b539487b)(JSON.parse(json), ','); - const html = (0, $c90c20f7be6ae7d5$export$c4b7cd609ccf4a5a)(`${(0, $d5b6ce321475881f$export$21c51bc433c16634).appName} - ${escape(displayName)}`, $cff73bb5fafa0795$var$embedScript(csv, displayName, snapshots)); - return html; -} - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -function $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: (0, $e295d8097c1ad61a$exports).classList('sanddance-group', props.className) - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "group-head" - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("label", null, props.label), props.labelCount && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("span", { - className: "count" - }, "(", props.labelCount, ")")), props.children && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "group-body" - }, props.children)); -} - - - - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ -function $2ec5b051a3376e1a$export$ce08aabc421980f4(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, props.allColumns.map((c, i)=>(0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - key: c.name - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("label", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Toggle, { - checked: props.exclusions.indexOf(c.name) < 0, - inlineLabel: true, - label: c.name, - onChange: ()=>props.toggleExclusion(c.name) - }))))); -} - - - - -const $b4b5d5b480eaf9ae$var$singleFacetLayouts = [ - { - facetStyle: 'wrap', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelFacetLayoutWrap - } -]; -const $b4b5d5b480eaf9ae$export$3fab399b77d7be2a = [ - { - key: 'grid', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeGrid - }, - { - key: 'scatterplot', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeScatterPlot - }, - { - key: 'density', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeDensity - }, - { - key: 'barchartV', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeBarChartV - }, - { - key: 'barchartH', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeBarChartH - }, - { - key: 'treemap', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeTreeMap - }, - { - key: 'strips', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeStrips - }, - { - key: 'stacks', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).chartTypeStacks - } -]; -function $b4b5d5b480eaf9ae$export$7d1536ca08644643(key) { - for(let i = 0; i < $b4b5d5b480eaf9ae$export$3fab399b77d7be2a.length; i++){ - if (key === $b4b5d5b480eaf9ae$export$3fab399b77d7be2a[i].key) return $b4b5d5b480eaf9ae$export$3fab399b77d7be2a[i].text; - } -} -function $b4b5d5b480eaf9ae$var$_Chart(_props) { - class __Chart extends (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.Component { - constructor(props){ - super(props); - this.state = { - showTooltipDialog: false - }; - this.choiceRef = (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = this.choiceRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - } - render() { - const { props: props } = this; - const { explorer: explorer, specCapabilities: specCapabilities } = props; - const signals = explorer.viewer && explorer.viewer.vegaSpec && specCapabilities && specCapabilities.signals && explorer.viewer.vegaSpec.signals.filter((s)=>specCapabilities.signals.indexOf(s.name) >= 0); - const hasOptions = !!signals || (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage); - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelChart - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "calculator" - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.ChoiceGroup, { - componentRef: this.choiceRef, - selectedKey: props.chart, - className: "sanddance-chart-type", - options: $b4b5d5b480eaf9ae$export$3fab399b77d7be2a.map((o)=>{ - return Object.assign(Object.assign({}, o), { - disabled: props.disabled || o.key === 'treemap' && props.quantitativeColumns.length === 0 - }); - }), - onChange: (e, o)=>props.explorer.changeChartType(o.key) - }))), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelColumnMapping - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, specCapabilities && specCapabilities.roles.map((specRole, i)=>{ - const specColumnInRole = props.insightColumns[specRole.role]; - const selectedColumnName = specColumnInRole; - let disabledColumnName; - let prefix; - let suffix; - let hideDropdown = false; - let { totalStyle: totalStyle } = props; - if (!totalStyle) totalStyle = 'count-square'; - let { facetStyle: facetStyle } = props; - if (!facetStyle) facetStyle = 'wrap'; - switch(specRole.role){ - case 'facet': - suffix = (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - disabled: !props.insightColumns.facet, - collapseLabel: props.collapseLabels, - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelFacetLayout, - calloutProps: { - style: { - minWidth: '18em' - } - }, - options: [ - { - key: 'header1', - text: `${(0, $d5b6ce321475881f$export$21c51bc433c16634).labelFacetLayout}:`, - itemType: (0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DropdownMenuItemType.Header - }, - ...$b4b5d5b480eaf9ae$var$singleFacetLayouts.map((f)=>{ - const o = { - key: f.facetStyle, - text: f.text, - data: f, - selected: facetStyle === f.facetStyle - }; - return o; - }), - { - key: 'divider', - text: '-', - itemType: (0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DropdownMenuItemType.Divider - }, - { - key: 'header2', - text: `${(0, $d5b6ce321475881f$export$21c51bc433c16634).labelColumnFacetV}:`, - itemType: (0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DropdownMenuItemType.Header - }, - ...(0, $3ecc97321af8bbc8$export$c171b40a34e110b5)(Object.assign(Object.assign({}, props), { - specRole: specRole, - selectedColumnName: props.insightColumns.facetV - })).map((o)=>{ - if (o.itemType !== (0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DropdownMenuItemType.Header) { - const facetData = { - facetStyle: 'cross', - column: o.data - }; - o.data = facetData; - o.text = `${(0, $d5b6ce321475881f$export$21c51bc433c16634).labelFacetLayoutCross} ${o.text}`; - } - return o; - }) - ], - onChange: (e, o)=>{ - const facetData = o.data; - props.changeColumnMapping('facet', 'facet', null, { - facetStyle: facetData.facetStyle - }); - if (facetData.facetStyle === 'cross') props.changeColumnMapping('facetV', (0, $1342cf7df79546f0$exports).VegaMorphCharts.util.clone(facetData.column)); - } - }); - break; - case 'facetV': - hideDropdown = true; - break; - case 'size': - { - const options = [ - { - key: 'count-square', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTotalByCountSquare, - data: 'count-square', - selected: !totalStyle || totalStyle === 'count-square' - }, - { - key: 'count-strip', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTotalByCountStrip, - data: 'count-strip', - selected: totalStyle === 'count-strip' - }, - { - key: 'sum-strip', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTotalBySumStrip, - data: 'sum-strip', - selected: totalStyle === 'sum-strip' - }, - { - key: 'sum-treemap', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTotalBySumTreemap, - data: 'sum-treemap', - selected: totalStyle === 'sum-treemap', - disabled: props.quantitativeColumns.length === 0 - } - ]; - if (specCapabilities.percentage) options.push({ - key: 'sum-strip-percent', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTotalBySumStripPercent, - data: 'sum-strip-percent', - selected: totalStyle === 'sum-strip-percent', - disabled: props.quantitativeColumns.length === 0 - }); - prefix = !specCapabilities.countsAndSums ? null : (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - collapseLabel: props.collapseLabels, - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTotal, - calloutProps: { - style: { - minWidth: '18em' - } - }, - options: options, - onChange: (e, o)=>{ - const totalStyle = o.data; - let defaultColumn; - if (totalStyle.indexOf('sum-') === 0) { - if (totalStyle === 'sum-treemap') defaultColumn = (0, $cdd6162a40e9c08a$export$7e0d3b5c6570ae8b)(props.allColumns); - defaultColumn = defaultColumn || props.quantitativeColumns[0]; - } - props.changeColumnMapping('size', 'size', defaultColumn, { - totalStyle: totalStyle - }); - } - }); - break; - } - } - const disabled = props.disabled || specRole.disabled || specRole.role === 'size' && !(!specCapabilities.countsAndSums || totalStyle.indexOf('sum-') === 0) || specRole.role === 'sort' && specCapabilities.countsAndSums && totalStyle === 'sum-treemap'; - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $3ecc97321af8bbc8$export$83b9e0badda50eeb), Object.assign({}, props, { - prefix: prefix, - suffix: suffix, - collapseLabel: props.collapseLabels, - disabled: disabled, - disabledColumnName: disabledColumnName, - selectedColumnName: selectedColumnName, - specRole: specRole, - key: i, - onChangeSignal: (name, value)=>props.onChangeSignal(specRole.role, selectedColumnName, name, value), - hideDropdown: hideDropdown - })); - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DefaultButton, { - className: 'sanddance-chart-button', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonTooltipMapping, - onClick: ()=>this.setState({ - showTooltipDialog: true - }) - }))), hasOptions && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelChartTypeOptions - }, signals && signals.map((signal, i)=>(0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $00e2720d7006b5f2$export$8210dfe1863c478), { - key: i, - signal: signal, - explorer: explorer, - initialValue: (0, $00e2720d7006b5f2$export$d54e4e563d2a9303)(explorer, signal), - disabled: props.disabled || this.disableSignal(signal), - collapseLabel: props.collapseLabels, - newViewStateTarget: false - })), (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage) && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DefaultButton, { - className: 'sanddance-chart-button', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonBackgroundImage, - onClick: ()=>{ - let insightColumns; - switch(props.chart){ - case 'scatterplot': - case 'stacks': - insightColumns = props.insightColumns; - break; - } - if (!insightColumns) insightColumns = props.explorer.changeChartType('scatterplot'); - this.backgroundImageEditor.show(insightColumns); - } - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f4b615ab5c14d90e$export$3ddf2d174ce01153), { - hidden: !this.state.showTooltipDialog, - onDismiss: ()=>this.setState({ - showTooltipDialog: false - }), - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTooltipMapping - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $2ec5b051a3376e1a$export$ce08aabc421980f4), { - allColumns: props.allColumns, - exclusions: props.tooltipExclusions, - toggleExclusion: props.toggleTooltipExclusion - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $15c8a952544b8f28$export$5696019163aa3cca), Object.assign({}, props, { - ref: (e)=>this.backgroundImageEditor = e - }))); - } - disableSignal(signal) { - if (this.props.view === '2d' && signal.name === (0, $1342cf7df79546f0$exports).constants.SignalNames.ZGrounded) return true; - return false; - } - } - return new __Chart(_props); -} -const $b4b5d5b480eaf9ae$export$acaa6426d77a227e = $b4b5d5b480eaf9ae$var$_Chart; - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ -function $4b388f5c1e44e369$export$2c73285ae9390cec(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.TextField, Object.assign({ - onKeyUp: (e)=>{ - e.nativeEvent.stopImmediatePropagation(); - } - }, props)); -} - - - - -const $420fc835a380b3a6$export$210195f4ae250f0a = 100; -function $420fc835a380b3a6$export$c2b32f315f251228(column) { - const type = column && column.type; - switch(type){ - case 'boolean': - return [ - [ - '==', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchEQ - ], - [ - '!=', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchNEQ - ], - [ - 'isnullorEmpty', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchNULL - ] - ]; - case 'date': - case 'integer': - case 'number': - return [ - [ - '==', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchEQ - ], - [ - '!=', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchNEQ - ], - [ - '>', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchGT - ], - [ - '>=', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchGTE - ], - [ - '<', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchLT - ], - [ - '<=', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchLTE - ], - [ - 'isnullorEmpty', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchNULL - ] - ]; - case 'string': - default: - return [ - [ - '==', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchEQ - ], - [ - '!=', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchNEQ - ], - [ - '>', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchGT - ], - [ - '>=', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchGTE - ], - [ - '<', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchLT - ], - [ - '<=', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchLTE - ], - [ - 'contains', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchIN - ], - [ - 'starts', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchSW - ], - [ - 'isnullorEmpty', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchNULL - ] - ]; - } -} -function $420fc835a380b3a6$var$getExpressionClauses(currClause, disableOR) { - const keys = [ - [ - '&&', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchAND - ] - ]; - if (!disableOR) keys.push([ - '||', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchOR - ]); - return keys.map((key, i)=>{ - const [clause, text] = key; - const selected = currClause == clause; //deliberate double equal - const option = { - key: i, - text: text, - data: clause, - selected: selected - }; - return option; - }); -} -function $420fc835a380b3a6$var$getOperators(ex, column) { - let anySelected = false; - const validOperators = $420fc835a380b3a6$export$c2b32f315f251228(column); - const options = validOperators.map((validoperator)=>{ - const [op, text] = validoperator; - const selected = ex.operator === op; - anySelected = anySelected || selected; - const option = { - key: op, - text: text, - data: op, - selected: selected - }; - return option; - }); - if (!anySelected) options[0].selected = true; - return options; -} -function $420fc835a380b3a6$var$getDistinctValues(data, columnName) { - const distinctMap = {}; - for(let i = 0; i < data.length; i++){ - const row = data[i]; - const value = row[columnName]; - distinctMap[value] = true; - } - return Object.keys(distinctMap).sort(); -} -function $420fc835a380b3a6$var$getValues(ex, column, data, autoCompleteDistinctValues) { - const stats = column && column.stats; - if (stats && stats.distinctValueCount < $420fc835a380b3a6$export$210195f4ae250f0a) { - if (!autoCompleteDistinctValues[column.name]) autoCompleteDistinctValues[column.name] = $420fc835a380b3a6$var$getDistinctValues(data, column.name); - return autoCompleteDistinctValues[column.name].map((v, i)=>({ - key: i, - text: v - })); - } - return []; -} -function $420fc835a380b3a6$export$c72d34660a162238(ex) { - if (ex.operator === 'isnullorEmpty') return ''; - return typeof ex.value === 'string' ? ex.value : ex.value == null ? '' : ex.value.toString(); -} -function $420fc835a380b3a6$export$793106cac50ab579(props) { - const ex = props.searchExpression; - const possibleValues = $420fc835a380b3a6$var$getValues(ex, props.column, props.data, props.autoCompleteDistinctValues); - //TODO better date handling with calendar picker - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, props.index > 0 && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchClause, - dropdownWidth: 120, - disabled: !ex.unlocked || props.disableOR, - options: $420fc835a380b3a6$var$getExpressionClauses(ex.clause, props.disableOR), - onChange: (e, o)=>props.onUpdateExpression({ - clause: o.data - }, props.index) - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - componentRef: props.dropdownRef, - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchColumn, - options: [ - { - key: '', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectAny, - data: null, - selected: ex.name === null - } - ].concat(props.columns.map((c, i)=>({ - key: c.name, - text: c.name, - data: c, - selected: c.name === ex.name - }))), - onChange: (e, o)=>props.onUpdateExpression({ - name: o.data && o.data.name || null - }, props.index) - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchOperator, - dropdownWidth: 120, - options: $420fc835a380b3a6$var$getOperators(ex, props.column), - onChange: (e, o)=>props.onUpdateExpression({ - operator: o.data - }, props.index) - }), possibleValues.length > 0 && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.ComboBox, { - className: "search-field", - label: props.collapseLabels ? null : (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchValue, - placeholder: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchValuePlaceholder, - disabled: ex.operator === 'isnullorEmpty', - dropdownWidth: (0, $8f56f1ed6ae42f13$export$8263e1ed1ef30f07), - allowFreeform: true, - autoComplete: "on", - errorMessage: ex.errorMessage, - text: $420fc835a380b3a6$export$c72d34660a162238(ex), - options: $420fc835a380b3a6$var$getValues(ex, props.column, props.data, props.autoCompleteDistinctValues), - onChange: (e, o, i, value)=>{ - if (o) value = o.text; - props.onUpdateExpression({ - value: value - }, props.index); - } - }), possibleValues.length === 0 && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $4b388f5c1e44e369$export$2c73285ae9390cec), { - className: "search-field", - label: props.collapseLabels ? null : (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchValue, - placeholder: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchValuePlaceholder, - disabled: ex.operator === 'isnullorEmpty', - errorMessage: ex.errorMessage, - value: $420fc835a380b3a6$export$c72d34660a162238(ex), - onChange: (e, v)=>props.onUpdateExpression({ - value: v - }, props.index) - })); -} - - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ -function $f9294a04a77df05a$export$353f5b6fc5456de1(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DefaultButton, Object.assign({}, props, { - styles: { - root: Object.assign({ - backgroundColor: 'transparent', - height: '30px', - width: props.width, - padding: 0 - }, props.rootStyle), - rootDisabled: { - backgroundColor: 'transparent' - }, - icon: { - color: props.themePalette.themePrimary - }, - label: { - fontWeight: '400', - textAlign: props.textAlign || 'left' - } - }, - iconProps: { - iconName: props.iconName - } - })); -} - - - - - - -const $7c89aab16f679c36$var$maxClauses = 5; -function $7c89aab16f679c36$var$getColumnWithName(columnName, columns) { - for(let i = 0; i < columns.length; i++){ - if (columns[i].name === columnName) return columns[i]; - } -} -function $7c89aab16f679c36$var$validateExpression(ex) { - if (ex.operator === 'isnullorEmpty') { - ex.errorMessage = null; - return; - } - const s = (0, $420fc835a380b3a6$export$c72d34660a162238)(ex); - if (s.length === 0) ex.errorMessage = (0, $d5b6ce321475881f$export$21c51bc433c16634).labelRequired; - else ex.errorMessage = null; -} -function $7c89aab16f679c36$var$clearExpressionValidation(ex) { - if (ex.operator === 'isnullorEmpty') { - ex.errorMessage = null; - return; - } - const s = (0, $420fc835a380b3a6$export$c72d34660a162238)(ex); - if (s.length !== 0) ex.errorMessage = null; -} -function $7c89aab16f679c36$var$getGroupClauses(currClause, index, disableGroupOR) { - let keys; - if (index === 0) keys = [ - [ - null, - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchWHERE - ] - ]; - else { - keys = [ - [ - '&&', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchAND - ] - ]; - if (!disableGroupOR) keys.push([ - '||', - (0, $d5b6ce321475881f$export$21c51bc433c16634).searchOR - ]); - } - return keys.map((key, i)=>{ - const [clause, text] = key; - const selected = currClause == clause; //deliberate double equal - const option = { - key: i, - text: text, - data: clause, - selected: selected - }; - return option; - }); -} -function $7c89aab16f679c36$var$_Search(_props) { - class __Search extends (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.Component { - constructor(props){ - super(props); - this.state = this.getInitialState(this.props); - this.dropdownRef = (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - } - getInitialState(props) { - const initialState = { - groups: props.initializer.search || [ - this.newGroup(0, null) - ], - sortedColumns: [ - ...props.initializer.columns - ].sort((a, b)=>a.name.localeCompare(b.name)), - initializer: props.initializer - }; - initialState.groups.forEach((group)=>{ - group.expressions.forEach((ex)=>ex.unlocked = group.expressions.length <= 2); - }); - return initialState; - } - componentDidUpdate() { - if (!(0, $e295d8097c1ad61a$exports).deepCompare(this.props.initializer, this.state.initializer)) this.setState(this.getInitialState(this.props)); - } - validateAndSearch() { - const groups = [ - ...this.state.groups - ]; - groups.forEach((group)=>{ - group.expressions.forEach($7c89aab16f679c36$var$validateExpression); - const errors = group.expressions.reduce((p, c)=>p || c.errorMessage, ''); - if (errors) this.setState({ - groups: groups - }); - else this.props.onSelect(this.state.groups); - }); - } - newGroup(key, clause) { - const group = { - key: key, - clause: clause, - expressions: [ - this.newExpression(0, null) - ] - }; - return group; - } - updateGroup(partialGroup, groupIndex) { - const groups = [ - ...this.state.groups - ]; - const group = Object.assign(Object.assign({}, groups[groupIndex]), partialGroup); - groups[groupIndex] = group; - this.setState({ - groups: groups - }); - } - addGroup() { - const groups = [ - ...this.state.groups - ]; - const maxKey = groups.reduce((max, p)=>p.key > max ? p.key : max, groups[0].key); - const newGroup = this.newGroup(maxKey + 1, '&&'); - groups.push(newGroup); - this.setState({ - groups: groups - }); - } - deleteGroup(groupIndex) { - const groups = [ - ...this.state.groups - ]; - groups.splice(groupIndex, 1); - this.setState({ - groups: groups - }); - } - newExpression(key, clause) { - const ex = { - key: key, - clause: clause, - name: null, - operator: 'contains', - value: '' - }; - return ex; - } - addExpression(groupIndex) { - const groups = [ - ...this.state.groups - ]; - const group = Object.assign({}, groups[groupIndex]); - const expressions = [ - ...group.expressions - ]; - const maxKey = expressions.reduce((max, p)=>p.key > max ? p.key : max, expressions[0].key); - const newEx = this.newExpression(maxKey + 1, '&&'); - expressions.push(newEx); - if (expressions.length === 2) newEx.unlocked = true; - else { - expressions.forEach((ex)=>ex.unlocked = false); - newEx.clause = expressions[1].clause; - } - group.expressions = expressions; - groups[groupIndex] = group; - this.setState({ - groups: groups - }); - } - updateExpression(partialEx, groupIndex, index) { - const groups = [ - ...this.state.groups - ]; - const group = Object.assign({}, groups[groupIndex]); - const expressions = [ - ...group.expressions - ]; - const currentEx = expressions[index]; - if (currentEx.name !== partialEx.name) { - //choose an appropriate operator when switching data type - const oldColumn = $7c89aab16f679c36$var$getColumnWithName(currentEx.name, this.state.sortedColumns); - const newColumn = $7c89aab16f679c36$var$getColumnWithName(partialEx.name, this.state.sortedColumns); - const oldType = oldColumn && oldColumn.type; - const newType = newColumn && newColumn.type; - if (oldType !== newType) { - const newOperators = (0, $420fc835a380b3a6$export$c2b32f315f251228)(newColumn).map((validOperator)=>validOperator[0]); - //see if old operator is compatible - if (newOperators.indexOf(currentEx.operator) < 0) //not compatible, so choose "equal" - partialEx.operator = '=='; - } - } - const ex = Object.assign(Object.assign({}, currentEx), partialEx); - $7c89aab16f679c36$var$clearExpressionValidation(ex); - expressions[index] = ex; - group.expressions = expressions; - groups[groupIndex] = group; - this.setState({ - groups: groups - }); - } - deleteExpression(groupIndex, index) { - const groups = [ - ...this.state.groups - ]; - const group = Object.assign({}, groups[groupIndex]); - const expressions = [ - ...group.expressions - ]; - expressions.splice(index, 1); - if (expressions.length === 2) expressions[1].unlocked = true; - group.expressions = expressions; - groups[groupIndex] = group; - this.setState({ - groups: groups - }); - } - render() { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - className: "sanddance-search", - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearch - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, this.state.groups.map((group, groupIndex)=>(0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "sanddance-search-group", - key: group.key - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - collapseLabel: this.props.collapseLabels, - className: "search-group-clause", - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearchClause, - disabled: groupIndex === 0 || this.props.disableGroupOR, - dropdownWidth: 120, - options: $7c89aab16f679c36$var$getGroupClauses(group.clause, groupIndex, this.props.disableGroupOR), - onChange: (e, o)=>this.updateGroup({ - clause: o.data - }, groupIndex) - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, group.expressions.map((ex, i)=>(0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "sanddance-search-expression", - key: ex.key - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $420fc835a380b3a6$export$793106cac50ab579), { - dropdownRef: groupIndex === 0 && i === 0 ? this.dropdownRef : undefined, - collapseLabels: this.props.collapseLabels, - onUpdateExpression: (ex, i)=>this.updateExpression(ex, groupIndex, i), - autoCompleteDistinctValues: this.props.autoCompleteDistinctValues, - index: i, - columns: this.state.sortedColumns, - data: this.props.data, - searchExpression: ex, - disableOR: this.props.disableExpressionOR, - column: $7c89aab16f679c36$var$getColumnWithName(ex.name, this.state.sortedColumns) - }), group.expressions.length > 1 && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f9294a04a77df05a$export$353f5b6fc5456de1), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Cancel", - onClick: ()=>this.deleteExpression(groupIndex, i), - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonDeleteExpression - })))), group.expressions.length < $7c89aab16f679c36$var$maxClauses && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f9294a04a77df05a$export$353f5b6fc5456de1), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Add", - onClick: ()=>this.addExpression(groupIndex), - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonAddExpression - })), this.state.groups.length > 1 && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f9294a04a77df05a$export$353f5b6fc5456de1), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Cancel", - onClick: ()=>this.deleteGroup(groupIndex), - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonDeleteExpressionGroup - }))), this.state.groups.length < $7c89aab16f679c36$var$maxClauses && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f9294a04a77df05a$export$353f5b6fc5456de1), { - themePalette: this.props.themePalette, - className: "search-action search-bottom-action", - iconName: "Add", - onClick: ()=>this.addGroup(), - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonAddExpressionGroup - }))), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.PrimaryButton, { - className: "search-action search-bottom-action", - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonSelect, - onClick: ()=>this.validateAndSearch() - })); - } - } - return new __Search(_props); -} -const $7c89aab16f679c36$export$4b85d3515bd863a5 = $7c89aab16f679c36$var$_Search; - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - -var $4293b5c02e7b8c3d$var$PresenterElement = (0, $1342cf7df79546f0$exports).VegaMorphCharts.PresenterElement; -function $4293b5c02e7b8c3d$export$f80a6900d44a74ee(viewer) { - const tags = viewer.presenter.getElement($4293b5c02e7b8c3d$var$PresenterElement.gl).getElementsByTagName('canvas'); - if (tags) return tags[0]; -} -function $4293b5c02e7b8c3d$export$95ea862e038e2d34(viewer) { - const canvas = $4293b5c02e7b8c3d$export$f80a6900d44a74ee(viewer); - if (canvas) canvas.tabIndex = -1; -} -const $4293b5c02e7b8c3d$export$8e76ac9f37578d1b = { - webgl: !!document.createElement('canvas').getContext('webgl'), - webgl2: !!document.createElement('canvas').getContext('webgl2') -}; - - - - - - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ const $ce16cf456563b677$export$83d89fbfd8236492 = '4.1.8'; - - -var $e46ab1f70cbc9878$var$SandDance = $1342cf7df79546f0$exports; -var $e46ab1f70cbc9878$var$DataRefType; -(function(DataRefType) { - DataRefType[DataRefType["none"] = 0] = "none"; - DataRefType[DataRefType["inline"] = 1] = "inline"; - DataRefType[DataRefType["url"] = 2] = "url"; -})($e46ab1f70cbc9878$var$DataRefType || ($e46ab1f70cbc9878$var$DataRefType = {})); -function $e46ab1f70cbc9878$var$filterSignals(signal) { - switch(signal.name){ - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.XBins: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.YBins: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.FacetBins: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.FacetVBins: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.ColorBinCount: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.ColorReverse: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.PointScale: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.TreeMapMethod: - case $e46ab1f70cbc9878$var$SandDance.constants.SignalNames.ZGrounded: - return false; - default: - return !!signal.bind; - } -} -function $e46ab1f70cbc9878$var$cloneData(vegaSpec) { - const data0 = vegaSpec.data[0]; - const valuesData = data0; - const values = valuesData.values; - delete valuesData.values; - const data = $e46ab1f70cbc9878$var$SandDance.VegaMorphCharts.util.clone(vegaSpec.data); - valuesData.values = values; - return { - data: data, - values: values - }; -} -function $e46ab1f70cbc9878$var$cloneScales(vegaSpec) { - return $e46ab1f70cbc9878$var$SandDance.VegaMorphCharts.util.clone(vegaSpec.scales); -} -function $e46ab1f70cbc9878$var$serializeSpec(vegaSpec, datafile, dataRefType, transform, scheme) { - const scales = $e46ab1f70cbc9878$var$cloneScales(vegaSpec); - const colorScale = scales.filter((scale)=>scale.name === $e46ab1f70cbc9878$var$SandDance.constants.ScaleNames.Color)[0]; - if (scheme.indexOf('dual_') >= 0) colorScale.range = $e46ab1f70cbc9878$var$SandDance.colorSchemes.filter((cs)=>cs.scheme === scheme)[0].colors; - const clone = $e46ab1f70cbc9878$var$cloneData(vegaSpec); - const data0 = clone.data[0]; - if (dataRefType === $e46ab1f70cbc9878$var$DataRefType.inline) { - const valuesData = data0; - valuesData.format = { - parse: 'auto', - type: 'json' - }; - valuesData.values = clone.values; - } else if (dataRefType === $e46ab1f70cbc9878$var$DataRefType.none) { - const valuesData = data0; - valuesData.values = []; - if (transform) { - if (valuesData.transform) valuesData.transform.push.apply(valuesData.transform, transform); - else valuesData.transform = transform; - } - } else if (dataRefType === $e46ab1f70cbc9878$var$DataRefType.url) { - const urlData = data0; - urlData.url = datafile.dataUrl; - urlData.format = { - parse: 'auto', - type: datafile.type - }; - if (transform) { - if (urlData.transform) urlData.transform.push.apply(urlData.transform, transform); - else urlData.transform = transform; - } - } - return Object.assign(Object.assign({}, vegaSpec), { - data: clone.data, - scales: scales - }); -} -function $e46ab1f70cbc9878$var$defaultDataRefType(datafile) { - if (datafile.dataUrl) return $e46ab1f70cbc9878$var$DataRefType.url; - return $e46ab1f70cbc9878$var$DataRefType.none; -} -function $e46ab1f70cbc9878$var$initState(props) { - return { - showSystemDialog: false, - showVegaDialog: false, - dataRefType: $e46ab1f70cbc9878$var$defaultDataRefType(props.dataFile), - spec: null - }; -} -function $e46ab1f70cbc9878$var$signalGroupKey(key) { - for(let i = 0; i < (0, $d5b6ce321475881f$export$21c51bc433c16634).signalGroups.length; i++){ - if ((0, $d5b6ce321475881f$export$21c51bc433c16634).signalGroups[i].prefix === key) return key; - } - return '*'; -} -function $e46ab1f70cbc9878$var$vegaSignalGroups(vegaSignals) { - const signalGroupMap = {}; - vegaSignals.forEach((vs)=>{ - const split = vs.name.split('_'); - const key = $e46ab1f70cbc9878$var$signalGroupKey(split[0]); - signalGroupMap[key] = signalGroupMap[key] || []; - signalGroupMap[key].push(vs); - }); - return signalGroupMap; -} -function $e46ab1f70cbc9878$var$_Settings(_props) { - class __Settings extends (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.Component { - constructor(props){ - super(props); - this.state = $e46ab1f70cbc9878$var$initState(props); - } - render() { - const { props: props, state: state } = this; - if (!props.explorer.viewer || !props.explorer.viewer.vegaSpec) return null; - const options = [ - { - key: $e46ab1f70cbc9878$var$DataRefType.none, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectVegaSpecDataNone, - selected: this.state.dataRefType === $e46ab1f70cbc9878$var$DataRefType.none, - data: $e46ab1f70cbc9878$var$DataRefType.none - }, - !props.dataFile.rawText && { - key: $e46ab1f70cbc9878$var$DataRefType.url, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectVegaSpecDataUrl, - selected: this.state.dataRefType === $e46ab1f70cbc9878$var$DataRefType.url, - data: $e46ab1f70cbc9878$var$DataRefType.url - }, - { - key: $e46ab1f70cbc9878$var$DataRefType.inline, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectVegaSpecDataInline, - selected: this.state.dataRefType === $e46ab1f70cbc9878$var$DataRefType.inline, - data: $e46ab1f70cbc9878$var$DataRefType.inline - } - ].filter(Boolean); - const signalGroupMap = $e46ab1f70cbc9878$var$vegaSignalGroups(props.explorer.viewer.vegaSpec.signals); - let first = true; - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $d5b6ce321475881f$export$21c51bc433c16634).signalGroups.map((sg, gi)=>{ - const vegaSignals = signalGroupMap[sg.prefix]; - if (vegaSignals) { - const filteredVegaSignals = vegaSignals.filter($e46ab1f70cbc9878$var$filterSignals); - if (filteredVegaSignals.length > 0) return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - key: sg.prefix, - label: sg.label - }, filteredVegaSignals.map((signal, i)=>{ - const ref = (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createRef(); - if (first) { - first = false; - props.explorer.dialogFocusHandler.focus = ()=>{ - const f = ref.current; - if (f === null || f === void 0 ? void 0 : f.focus) f.focus(); - }; - } - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $00e2720d7006b5f2$export$8210dfe1863c478), { - componentRef: ref, - key: i, - signal: signal, - explorer: props.explorer, - initialValue: (0, $00e2720d7006b5f2$export$d54e4e563d2a9303)(props.explorer, signal), - newViewStateTarget: false - }); - })); - } - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelChartCanvas - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Toggle, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelShowAxes, - defaultChecked: !props.hideAxes, - onChange: (e, checked)=>props.onToggleAxes(!checked) - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Toggle, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelShowLegend, - defaultChecked: !props.hideLegend, - onChange: (e, checked)=>props.onToggleLegend(!checked) - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTools - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DefaultButton, { - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonShowVegaSpec, - onClick: ()=>this.setState({ - showVegaDialog: true, - spec: $e46ab1f70cbc9878$var$serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, this.state.dataRefType, props.explorer.viewer.getInsight().transform, this.props.scheme) - }) - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSnapshots - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Slider, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSnapshotSettingThumbnailWidth, - onChange: (value)=>{ - this.props.explorer.snapshotThumbWidth = value; - }, - min: 100, - max: 800, - defaultValue: this.props.explorer.snapshotThumbWidth - })), props.additionalSettings && props.additionalSettings.map((g, i)=>(0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - key: i, - label: g.groupLabel - }, g.children)), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSystem - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DefaultButton, { - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSystemInfo, - onClick: ()=>this.setState({ - showSystemDialog: true - }) - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f4b615ab5c14d90e$export$3ddf2d174ce01153), { - hidden: !state.showVegaDialog, - onDismiss: ()=>this.setState($e46ab1f70cbc9878$var$initState(this.props)), - minWidth: "80%", - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelVegaSpec, - buttons: [ - (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.PrimaryButton, { - key: "copy", - iconProps: { - iconName: 'Copy' - }, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonCopyToClipboard, - onClick: ()=>{ - const pre = document.getElementById('sanddance-vega-spec'); - const range = document.createRange(); - range.selectNode(pre); - const selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - document.execCommand('copy'); - } - }), - (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DefaultButton, { - key: "edit", - iconProps: { - iconName: 'OpenInNewWindow' - }, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonLaunchVegaEditor, - onClick: ()=>{ - window.open('https://vega.github.io/editor/', '_blank'); - } - }) - ] - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelVegaSpecData, - options: options, - onChange: (e, o)=>this.setState({ - dataRefType: o.data, - spec: $e46ab1f70cbc9878$var$serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, o.data, props.explorer.viewer.getInsight().transform, this.props.scheme) - }) - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("pre", { - id: "sanddance-vega-spec" - }, JSON.stringify(this.state.spec, null, 2)), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $d5b6ce321475881f$export$21c51bc433c16634).labelVegaSpecNotes)), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f4b615ab5c14d90e$export$3ddf2d174ce01153), { - hidden: !state.showSystemDialog, - onDismiss: ()=>this.setState($e46ab1f70cbc9878$var$initState(this.props)), - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSystemInfo - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("ul", null, this.props.children, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("li", null, "SandDanceExplorer version: ", (0, $ce16cf456563b677$export$83d89fbfd8236492)), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("li", null, "SandDanceReact version: ", $d76008c8107bb02f$export$83d89fbfd8236492), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("li", null, "SandDance version: ", $e46ab1f70cbc9878$var$SandDance.version), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("li", null, "Vega-MorphCharts version: ", $e46ab1f70cbc9878$var$SandDance.VegaMorphCharts.version), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("li", null, "WebGL enabled: ", (0, $4293b5c02e7b8c3d$export$8e76ac9f37578d1b).webgl ? (0, $d5b6ce321475881f$export$21c51bc433c16634).labelYes : (0, $d5b6ce321475881f$export$21c51bc433c16634).labelNo), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("li", null, "WebGL2 enabled: ", (0, $4293b5c02e7b8c3d$export$8e76ac9f37578d1b).webgl2 ? (0, $d5b6ce321475881f$export$21c51bc433c16634).labelYes : (0, $d5b6ce321475881f$export$21c51bc433c16634).labelNo)))); - } - } - return new __Settings(_props); -} -const $e46ab1f70cbc9878$export$c72f6eaae7b9adff = $e46ab1f70cbc9878$var$_Settings; - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - - - -function $e07b04fee87ea13f$var$_SnapshotEditor(_props) { - class __SnapshotEditor extends (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.Component { - constructor(props){ - super(props); - this.state = { - showEditFormDialog: false, - title: '', - description: '', - image: null, - bgColor: null, - insight: null, - editIndex: -1 - }; - } - resize(src, thumbWidth) { - if (!src) return; - const img = new Image(); - img.onload = ()=>{ - const canvas = document.createElement('canvas'), ctx = canvas.getContext('2d'); - const ratio = img.width / thumbWidth; - canvas.height = img.height / ratio; - canvas.width = thumbWidth; - ctx.drawImage(img, 0, 0, canvas.width, canvas.height); - const image = canvas.toDataURL(); - this.setState({ - image: image - }); - }; - img.src = src; - } - editSnapshot(snapshot, editIndex = -1) { - if (snapshot) this.setState(Object.assign(Object.assign({ - showEditFormDialog: true - }, snapshot), { - editIndex: editIndex - })); - else { - const { explorer: explorer } = this.props; - const signalValues = explorer.viewer.getSignalValues(); - explorer.viewer.deselect().then(()=>{ - const canvas = (0, $4293b5c02e7b8c3d$export$f80a6900d44a74ee)(explorer.viewer); - const bgColor = canvas && window.getComputedStyle(canvas).backgroundColor; - const insight = (0, $1342cf7df79546f0$exports).VegaMorphCharts.util.clone(explorer.viewer.getInsight()); - delete insight.size; - insight.signalValues = signalValues; - const title = this.props.getTitle && this.props.getTitle(insight) || ''; - const description = this.props.getDescription && this.props.getDescription(insight) || ''; - this.setState({ - showEditFormDialog: true, - bgColor: bgColor, - title: title, - description: description, - insight: insight, - image: null, - editIndex: editIndex - }); - //allow deselection to render - setTimeout(()=>{ - explorer.viewer.presenter.canvasToDataURL().then((dataUrl)=>{ - this.resize(dataUrl, explorer.snapshotThumbWidth); - }); - }, 500); - }); - } - } - render() { - var _a, _b; - const { explorer: explorer } = this.props; - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f4b615ab5c14d90e$export$3ddf2d174ce01153), { - modalProps: { - className: (0, $e295d8097c1ad61a$exports).classList('sanddance-snapshot-dialog', this.props.theme) - }, - minWidth: `${explorer.snapshotThumbWidth + 64}px`, - hidden: !this.state.showEditFormDialog, - onDismiss: ()=>this.setState({ - showEditFormDialog: false - }), - title: this.state.editIndex >= 0 ? (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonEditSnapshot : (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonCreateSnapshot, - buttons: (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.PrimaryButton, { - disabled: !this.state.image || !this.state.title, - key: 0, - onClick: (e)=>{ - const setup = (0, $1342cf7df79546f0$exports).VegaMorphCharts.util.clone(explorer.getSetup()); - if (setup.camera !== 'hold') //get the latest camera movement, instead of what's in state - setup.camera = explorer.viewer.getCamera(); - const snapshot = { - title: this.state.title, - description: this.state.description, - insight: this.state.insight, - image: this.state.image, - bgColor: this.state.bgColor, - setup: setup - }; - this.props.modifySnapShot && this.props.modifySnapShot(snapshot); - this.props.onWriteSnapshot(snapshot, this.state.editIndex); - this.setState({ - showEditFormDialog: false, - title: '', - description: '', - image: null - }); - }, - iconProps: { - iconName: 'Camera' - }, - text: this.state.editIndex >= 0 ? (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonUpdateSnapshot : (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonCreateSnapshot - }) - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.TextField, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSnapshotTitle, - onChange: (e, title)=>this.setState({ - title: title - }), - value: this.state.title - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.TextField, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSnapshotDescription, - onChange: (e, description)=>this.setState({ - description: description - }), - value: this.state.description, - multiline: true - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: 'thumbnail' - }, !this.state.image && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Spinner, null), this.state.image && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("img", { - src: this.state.image, - style: { - backgroundColor: this.state.bgColor - } - })), ((_b = (_a = explorer.viewer) === null || _a === void 0 ? void 0 : _a.colorContexts) === null || _b === void 0 ? void 0 : _b.length) > 1 && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $d5b6ce321475881f$export$21c51bc433c16634).labelColorFilter)); - } - } - return new __SnapshotEditor(_props); -} -const $e07b04fee87ea13f$export$15b376344cc89d12 = $e07b04fee87ea13f$var$_SnapshotEditor; - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - - - - -function $ce6d2e0261fc46dc$var$_Snapshots(_props) { - class __Snapshots extends (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.Component { - constructor(props){ - super(props); - this.state = { - confirmation: null, - title: '', - description: '', - image: null, - bgColor: null, - insight: null - }; - } - render() { - const items = [ - { - key: 'clear', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonClearSnapshots, - onClick: ()=>this.setState({ - confirmation: { - buttonText: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonClearSnapshots, - handler: ()=>this.props.onClearSnapshots() - } - }), - disabled: this.props.snapshots.length === 0 - } - ]; - if (this.props.getTopActions) items.push.apply(items, this.props.getTopActions(this.props.snapshots)); - const ref = (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createRef(); - this.props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - (_a = ref.current) === null || _a === void 0 || _a.focus(); - }; - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - className: "sanddance-snapshots", - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSnapshots - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.PrimaryButton, { - componentRef: ref, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonCreateSnapshot, - onClick: (e)=>this.props.editor.editSnapshot(), - split: true, - menuProps: { - items: items - } - }), this.props.getChildren && this.props.getChildren(this.props.snapshots), this.state.confirmation && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f4b615ab5c14d90e$export$3ddf2d174ce01153), { - hidden: false, - buttons: (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.PrimaryButton, { - key: 0, - onClick: (e)=>{ - this.setState({ - confirmation: null - }); - this.state.confirmation.handler(); - }, - iconProps: { - iconName: 'Delete' - }, - text: this.state.confirmation.buttonText - }), - onDismiss: ()=>this.setState({ - confirmation: null - }) - }, (0, $d5b6ce321475881f$export$21c51bc433c16634).labelConfirmation), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, this.props.snapshots.map((snapshot, i)=>{ - const actions = this.props.getActions && this.props.getActions(snapshot, i) || []; - actions.push({ - iconButtonProps: { - themePalette: this.props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonEditSnapshot, - onClick: (e)=>this.props.editor.editSnapshot(snapshot, i), - iconName: 'Edit' - } - }); - if (this.props.snapshots.length > 1) actions.push({ - iconButtonProps: { - disabled: i === 0, - themePalette: this.props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonMoveUp, - onClick: (e)=>this.props.onMoveUp(i), - iconName: 'SortUp' - } - }, { - iconButtonProps: { - disabled: i > this.props.snapshots.length - 2, - themePalette: this.props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonMoveDown, - onClick: (e)=>this.props.onMoveDown(i), - iconName: 'SortDown' - } - }); - actions.push({ - iconButtonProps: { - themePalette: this.props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonDeleteSnapshot, - onClick: ()=>this.setState({ - confirmation: { - buttonText: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonDeleteSnapshot, - handler: ()=>this.props.onRemoveSnapshot(i) - } - }), - iconName: 'Delete' - } - }); - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - key: i, - className: (0, $e295d8097c1ad61a$exports).classList('snapshot', i === this.props.selectedSnapshotIndex && 'selected') - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - onClick: (e)=>this.props.onSnapshotClick(snapshot, i) - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: 'title' - }, snapshot.title), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: 'thumbnail' - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("img", { - title: snapshot.description, - src: snapshot.image, - style: { - backgroundColor: snapshot.bgColor - } - }))), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement($ce6d2e0261fc46dc$var$Actions, { - actions: actions, - snapshot: snapshot - })); - })))); - } - } - return new __Snapshots(_props); -} -const $ce6d2e0261fc46dc$export$3e09886744a57615 = $ce6d2e0261fc46dc$var$_Snapshots; -function $ce6d2e0261fc46dc$var$Actions(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "actions" - }, props.actions.map((action, i)=>{ - if (action.iconButtonProps) return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $baf9c68afdd76912$export$c25acd513dcc8062), Object.assign({ - key: i - }, action.iconButtonProps)); - if (action.element) return action.element; - })); -} - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - - - - - -const $7169c11dc639bbc5$var$positions = [ - [ - 'x', - (0, $d5b6ce321475881f$export$21c51bc433c16634).labelAliasX - ], - [ - 'y', - (0, $d5b6ce321475881f$export$21c51bc433c16634).labelAliasY - ], - [ - 'z', - (0, $d5b6ce321475881f$export$21c51bc433c16634).labelAliasZ - ] -]; -const $7169c11dc639bbc5$var$autoScrubInterval = 50; //tune to get the smoothest animation while able to do an update pass through React -function $7169c11dc639bbc5$var$_TransitionEditor(_props) { - class __TransitionEditor extends (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.Component { - constructor(props){ - super(props); - this.state = Object.assign({ - scrub: 100, - pauseDisabled: true - }, this.initialCalc(props.transitionDurations)); - this.autoScrubber = new $7169c11dc639bbc5$var$AutoScrubber($7169c11dc639bbc5$var$autoScrubInterval, (direction, interval)=>{ - const totalMs = this.state.totalTransition * 1000; - const currentMs = this.state.scrub / 100 * totalMs; - const scrubMs = currentMs + direction * interval; - let scrub = scrubMs / totalMs * 100; - if (direction < 0 && scrub <= 0) { - scrub = 0; - this.autoScrubber.stop(); - } - if (direction > 0 && scrub >= 100) { - scrub = 100; - this.autoScrubber.stop(); - } - this.setScrubState(scrub); - }); - } - initialCalc(transitionDurations) { - const totalTransition = (transitionDurations.position + transitionDurations.stagger) / 1000; - const staggerPercent = transitionDurations.stagger === 0 ? 1 : transitionDurations.stagger / (totalTransition * 1000) * 100; - const viewTransition = transitionDurations.view / 1000; - return { - totalTransition: totalTransition, - staggerPercent: staggerPercent, - viewTransition: viewTransition - }; - } - setScrubState(scrub) { - const { morphChartsRenderResult: morphChartsRenderResult, morphchartsref: morphchartsref } = this.props.explorer.viewer.presenter; - morphchartsref.core.renderer.transitionTime = scrub / 100; - morphChartsRenderResult.setTransitionTimeAxesVisibility(); - scrub = Math.round(scrub); - this.setState({ - scrub: scrub, - pauseDisabled: this.autoScrubber.isStopped() - }); - } - setDurations() { - setTimeout(()=>{ - const { props: props, state: state } = this; - const { totalTransition: totalTransition, staggerPercent: staggerPercent, viewTransition: viewTransition } = state; - const stagger = totalTransition * staggerPercent / 100; - const { transitionDurations: transitionDurations } = props; - transitionDurations.position = (totalTransition - stagger) * 1000; - transitionDurations.stagger = stagger * 1000; - transitionDurations.view = viewTransition * 1000; - $7169c11dc639bbc5$export$39fa25c8c3576e7a(props.explorer.viewer, transitionDurations); - props.changeSetup(null, false); - }); - } - render() { - const { props: props, state: state } = this; - const { explorer: explorer, transitionDurations: transitionDurations, changeSetup: changeSetup } = props; - const sliderRef = (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createRef(); - explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransition - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Slider, { - componentRef: sliderRef, - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionScrubber, - min: 0, - max: 100, - valueFormat: (0, $d5b6ce321475881f$export$21c51bc433c16634).percentValueFormat, - value: state.scrub, - onChange: (scrub)=>{ - this.autoScrubber.stop(); - this.setScrubState(scrub); - } - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $baf9c68afdd76912$export$c25acd513dcc8062), { - themePalette: props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonTransitionReverse, - iconName: 'PlayReverseResume', - onClick: ()=>{ - this.autoScrubber.toggleScrubbing(-1); - if (state.scrub === 0) this.setState({ - scrub: 100 - }); - } - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $baf9c68afdd76912$export$c25acd513dcc8062), { - themePalette: props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonTransitionPause, - iconName: 'Pause', - onClick: ()=>{ - this.autoScrubber.togglePause(); - }, - disabled: state.pauseDisabled - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $baf9c68afdd76912$export$c25acd513dcc8062), { - themePalette: props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonTransitionPlay, - iconName: 'PlayResume', - onClick: ()=>{ - this.autoScrubber.toggleScrubbing(1); - if (state.scrub === 100) this.setState({ - scrub: 0 - }); - } - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionOptions - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Toggle, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelHoldCamera, - checked: explorer.state.holdCamera, - onChange: (e, holdCamera)=>{ - changeSetup({ - holdCamera: holdCamera - }, false); - } - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.ChoiceGroup, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerBy, - selectedKey: props.transitionType, - options: [ - { - key: 'ordinal', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerByOrdinal - }, - { - key: 'column', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerByColumn - }, - { - key: 'position', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerByPosition - } - ], - onChange: (e, o)=>{ - const transitionType = o.key; - changeSetup({ - transitionType: transitionType - }, true); - } - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerOptions - }, (()=>{ - switch(props.transitionType){ - case 'column': - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - collapseLabel: props.compactUI, - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerByColumn, - options: $7169c11dc639bbc5$var$getColumnOptions(props, props.transitionColumn.name), - onChange: (e, o)=>{ - changeSetup({ - transitionColumn: o.data - }, true); - } - }); - case 'position': - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $8f56f1ed6ae42f13$export$931cbfb6bfb85fc), { - collapseLabel: props.compactUI, - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerByPosition, - options: $7169c11dc639bbc5$var$positions.map(([key, text])=>{ - return { - key: key, - text: text, - selected: props.transitionDimension === key - }; - }), - onChange: (e, o)=>{ - changeSetup({ - transitionDimension: o.key - }, true); - } - }); - } - })(), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Toggle, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStaggerReverse, - checked: props.transitionReverse, - onChange: (e, transitionReverse)=>changeSetup({ - transitionReverse: transitionReverse - }, true) - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $5b1483fb7f067be1$export$eb2fcfdbd7ba97d4), { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionDurations - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Slider, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionDuration, - onChange: (totalTransition)=>{ - this.setState({ - totalTransition: totalTransition - }); - this.setDurations(); - }, - min: 0, - max: 5, - step: 0.1, - value: state.totalTransition - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Slider, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionStagger, - onChange: (staggerPercent)=>{ - this.setState({ - staggerPercent: staggerPercent - }); - this.setDurations(); - }, - min: 0, - max: 100, - valueFormat: (0, $d5b6ce321475881f$export$21c51bc433c16634).percentValueFormat, - value: state.staggerPercent - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Slider, { - label: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransitionCamera, - onChange: (viewTransition)=>{ - this.setState({ - viewTransition: viewTransition - }); - this.setDurations(); - }, - min: 0, - max: 5, - step: 0.1, - value: state.viewTransition - }), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f9294a04a77df05a$export$353f5b6fc5456de1), { - themePalette: props.themePalette, - onClick: ()=>{ - const defaults = (0, $1342cf7df79546f0$exports).VegaMorphCharts.defaults.defaultPresenterConfig.transitionDurations; - const { position: position, stagger: stagger, view: view } = defaults; - transitionDurations.position = position; - transitionDurations.stagger = stagger; - transitionDurations.view = view; - this.setState(Object.assign({}, this.initialCalc(transitionDurations))); - this.setDurations(); - }, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonResetToDefault - }))); - } - } - return new __TransitionEditor(_props); -} -const $7169c11dc639bbc5$export$df231814b4232ebd = $7169c11dc639bbc5$var$_TransitionEditor; -function $7169c11dc639bbc5$var$groupOptions(sectionName, columns, selectedKey) { - const options = columns.map((column)=>{ - const option = { - key: `column:${column.name}`, - text: column.name, - data: column, - selected: column.name === selectedKey - }; - return option; - }); - if (options.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: (0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.DropdownMenuItemType.Header - }; - options.unshift(option); - } - return options; -} -function $7169c11dc639bbc5$var$getColumnOptions(props, selectedKey) { - const quantitativeGroup = $7169c11dc639bbc5$var$groupOptions((0, $d5b6ce321475881f$export$21c51bc433c16634).selectNumeric, props.quantitativeColumns, selectedKey); - const categoricGroup = $7169c11dc639bbc5$var$groupOptions((0, $d5b6ce321475881f$export$21c51bc433c16634).selectNonNumeric, props.categoricalColumns, selectedKey); - return quantitativeGroup.concat(categoricGroup); -} -function $7169c11dc639bbc5$export$d5639c01d489b0c(state) { - const reverse = state.transitionReverse; - switch(state.transitionType){ - case 'ordinal': - return { - type: 'ordinal', - reverse: reverse - }; - case 'column': - return { - type: 'column', - column: state.transitionColumn, - reverse: reverse - }; - case 'position': - return { - type: 'position', - dimension: state.transitionDimension, - reverse: reverse - }; - } -} -function $7169c11dc639bbc5$export$39fa25c8c3576e7a(viewer, transitionDurations) { - var _a, _b; - const config = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.core.config; - if (config) { - const { position: position, stagger: stagger } = transitionDurations; - config.transitionDuration = position; - config.transitionStaggering = stagger; - } -} -class $7169c11dc639bbc5$var$AutoScrubber { - constructor(interval, onInterval){ - this.interval = interval; - this.onInterval = onInterval; - } - getSignedInterval() { - return this.interval * this.direction; - } - toggleScrubbing(direction) { - if (this.isScrubbing() && direction === this.direction) this.pause(); - else this.start(direction); - } - isPaused() { - return !this.isScrubbing() && this.direction !== undefined; - } - isStopped() { - return !this.isScrubbing() && this.direction === undefined; - } - isScrubbing() { - return this.autoScrubTimer !== undefined; - } - togglePause() { - if (this.isScrubbing()) this.pause(); - else if (this.direction) this.start(this.direction); - } - start(direction) { - this.direction = direction; - if (!this.isScrubbing()) this.autoScrubTimer = setInterval(()=>this.onInterval(this.direction, this.interval), this.interval); - } - pause() { - clearInterval(this.autoScrubTimer); - this.autoScrubTimer = undefined; - } - stop() { - this.pause(); - this.direction = undefined; - } -} - - -var $688b2ed8e5aa6452$exports = {}; - -$parcel$export($688b2ed8e5aa6452$exports, "Explorer", () => $688b2ed8e5aa6452$export$43584986cb77a794); -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - - -const $46e7ccd2bf7a69a1$var$className = 'sanddance-panel-tools'; -function $46e7ccd2bf7a69a1$var$ensureToolbar(panel) { - const existing = panel.getElementsByClassName($46e7ccd2bf7a69a1$var$className); - if (existing.length > 0) return existing[0]; - else { - const div = (0, $1342cf7df79546f0$exports).VegaMorphCharts.util.addDiv(panel, $46e7ccd2bf7a69a1$var$className); - panel.insertAdjacentElement('afterbegin', div); - return div; - } -} -function $46e7ccd2bf7a69a1$export$225a002951c27da7(presenter, showLegend, props) { - const panel = presenter.getElement((0, $1342cf7df79546f0$exports).VegaMorphCharts.PresenterElement.panel); - const div = $46e7ccd2bf7a69a1$var$ensureToolbar(panel); - (0, $a601a4135959dcb0$export$e2253033e6e1df16).reactDOM.render($46e7ccd2bf7a69a1$var$ColorMap(props), div); - panel.style.display = showLegend ? '' : 'none'; -} -function $46e7ccd2bf7a69a1$var$ColorMap(props) { - const menuProps = { - items: [ - { - key: 'new', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonColorSchemeRemap, - disabled: !props.canRemap || props.isRemap, - onClick: ()=>props.colorMapHandler(true) - }, - { - key: 'old', - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonColorSchemeKeep, - disabled: !props.canRemap || !props.isRemap, - onClick: ()=>props.colorMapHandler(false) - } - ] - }; - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $baf9c68afdd76912$export$c25acd513dcc8062), { - styles: { - menuIcon: { - display: 'none' - } - }, - themePalette: props.themePalette, - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonColorSchemeMap, - onClick: null, - iconName: props.canRemap ? 'FiltersSolid' : 'Filters', - menuProps: menuProps - })); -} - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ function $e3b58b932870fa44$export$ba25af89e7ea3c1a(newColumn, oldColumn, oldScheme) { - if (oldColumn && oldColumn.quantitative === newColumn.quantitative && $e3b58b932870fa44$var$defaultColorScheme(oldColumn) === $e3b58b932870fa44$var$defaultColorScheme(newColumn)) return oldScheme; - return $e3b58b932870fa44$var$defaultColorScheme(newColumn); -} -function $e3b58b932870fa44$var$defaultColorScheme(c) { - if (c.quantitative) return 'redyellowgreen'; - else if (c.stats.distinctValueCount === 2) return 'dual_redgreen'; - else if (c.stats.distinctValueCount <= 10) return 'category10'; - return 'category20'; -} - - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - - -function $9609e207e93b7923$export$2e2bcd8739ae039(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); -} -function $9609e207e93b7923$export$8f8e23dd27dc19f5(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = x.slice(0, i); - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). - return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) - ]; -} - - -function $75b9c15a84f36786$export$2e2bcd8739ae039(x) { - return x = (0, $9609e207e93b7923$export$8f8e23dd27dc19f5)(Math.abs(x)), x ? x[1] : NaN; -} - - -function $a4f5516ee00a18bc$export$2e2bcd8739ae039(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while(i > 0 && g > 0){ - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; -} - - -function $3db498c77a24c909$export$2e2bcd8739ae039(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; -} - - -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var $beac99c87b86c748$var$re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function $beac99c87b86c748$export$2e2bcd8739ae039(specifier) { - if (!(match = $beac99c87b86c748$var$re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new $beac99c87b86c748$export$963aac351db36ed4({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); -} -$beac99c87b86c748$export$2e2bcd8739ae039.prototype = $beac99c87b86c748$export$963aac351db36ed4.prototype; // instanceof -function $beac99c87b86c748$export$963aac351db36ed4(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} -$beac99c87b86c748$export$963aac351db36ed4.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; - - -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -function $bd6ac69290a29cb5$export$2e2bcd8739ae039(s) { - out: for(var n = s.length, i = 1, i0 = -1, i1; i < n; ++i)switch(s[i]){ - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; - break; - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; -} - - - - -var $58e383fbc32baa60$export$6863724d9a42263; -function $58e383fbc32baa60$export$2e2bcd8739ae039(x, p) { - var d = (0, $9609e207e93b7923$export$8f8e23dd27dc19f5)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1], i = exponent - ($58e383fbc32baa60$export$6863724d9a42263 = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + (0, $9609e207e93b7923$export$8f8e23dd27dc19f5)(x, Math.max(0, p + i - 1))[0]; // less than 1y! -} - - - -function $3903417d864b94de$export$2e2bcd8739ae039(x, p) { - var d = (0, $9609e207e93b7923$export$8f8e23dd27dc19f5)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); -} - - -var $865b2da11efc775a$export$2e2bcd8739ae039 = { - "%": function(x, p) { - return (x * 100).toFixed(p); - }, - "b": function(x) { - return Math.round(x).toString(2); - }, - "c": function(x) { - return x + ""; - }, - "d": (0, $9609e207e93b7923$export$2e2bcd8739ae039), - "e": function(x, p) { - return x.toExponential(p); - }, - "f": function(x, p) { - return x.toFixed(p); - }, - "g": function(x, p) { - return x.toPrecision(p); - }, - "o": function(x) { - return Math.round(x).toString(8); - }, - "p": function(x, p) { - return (0, $3903417d864b94de$export$2e2bcd8739ae039)(x * 100, p); - }, - "r": (0, $3903417d864b94de$export$2e2bcd8739ae039), - "s": (0, $58e383fbc32baa60$export$2e2bcd8739ae039), - "X": function(x) { - return Math.round(x).toString(16).toUpperCase(); - }, - "x": function(x) { - return Math.round(x).toString(16); - } -}; - - - -function $aca4ed01afa40869$export$2e2bcd8739ae039(x) { - return x; -} - - -var $afe689d3eee04304$var$map = Array.prototype.map, $afe689d3eee04304$var$prefixes = [ - "y", - "z", - "a", - "f", - "p", - "n", - "\xb5", - "m", - "", - "k", - "M", - "G", - "T", - "P", - "E", - "Z", - "Y" -]; -function $afe689d3eee04304$export$2e2bcd8739ae039(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? (0, $aca4ed01afa40869$export$2e2bcd8739ae039) : (0, $a4f5516ee00a18bc$export$2e2bcd8739ae039)($afe689d3eee04304$var$map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? (0, $aca4ed01afa40869$export$2e2bcd8739ae039) : (0, $3db498c77a24c909$export$2e2bcd8739ae039)($afe689d3eee04304$var$map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "-" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - function newFormat(specifier) { - specifier = (0, $beac99c87b86c748$export$2e2bcd8739ae039)(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - else if (!(0, $865b2da11efc775a$export$2e2bcd8739ae039)[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - // If zero fill is specified, padding goes after sign and before digits. - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = (0, $865b2da11efc775a$export$2e2bcd8739ae039)[type], maybeSuffix = /[defgprs%]/.test(type); - // Set the default precision if not specified, - // or clamp the specified precision to the supported range. - // For significant precision, it must be in [1, 21]. - // For fixed precision, it must be in [0, 20]. - precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - // Trim insignificant zeros. - if (trim) value = (0, $bd6ac69290a29cb5$export$2e2bcd8739ae039)(value); - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? $afe689d3eee04304$var$prefixes[8 + (0, $58e383fbc32baa60$export$6863724d9a42263) / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while(++i < n)if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - // Reconstruct the final output based on the desired alignment. - switch(align){ - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format.toString = function() { - return specifier + ""; - }; - return format; - } - function formatPrefix(specifier, value) { - var f = newFormat((specifier = (0, $beac99c87b86c748$export$2e2bcd8739ae039)(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor((0, $75b9c15a84f36786$export$2e2bcd8739ae039)(value) / 3))) * 3, k = Math.pow(10, -e), prefix = $afe689d3eee04304$var$prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; - } - return { - format: newFormat, - formatPrefix: formatPrefix - }; -} - - -var $25eae809e43888aa$var$locale; -var $25eae809e43888aa$export$d9468344d3651243; -var $25eae809e43888aa$export$8d85692a469dde6f; -$25eae809e43888aa$export$2e2bcd8739ae039({ - decimal: ".", - thousands: ",", - grouping: [ - 3 - ], - currency: [ - "$", - "" - ], - minus: "-" -}); -function $25eae809e43888aa$export$2e2bcd8739ae039(definition) { - $25eae809e43888aa$var$locale = (0, $afe689d3eee04304$export$2e2bcd8739ae039)(definition); - $25eae809e43888aa$export$d9468344d3651243 = $25eae809e43888aa$var$locale.format; - $25eae809e43888aa$export$8d85692a469dde6f = $25eae809e43888aa$var$locale.formatPrefix; - return $25eae809e43888aa$var$locale; -} - - -var $86b892255d8eb4f0$export$f0297ce57faf7d71; -(function(DataScopeId) { - DataScopeId[DataScopeId["AllData"] = 0] = "AllData"; - DataScopeId[DataScopeId["SelectedData"] = 1] = "SelectedData"; - DataScopeId[DataScopeId["FilteredData"] = 2] = "FilteredData"; -})($86b892255d8eb4f0$export$f0297ce57faf7d71 || ($86b892255d8eb4f0$export$f0297ce57faf7d71 = {})); -function $86b892255d8eb4f0$export$6d13117e74df8390(selectedItemIndex) { - selectedItemIndex[$86b892255d8eb4f0$export$f0297ce57faf7d71.AllData] = 0; - selectedItemIndex[$86b892255d8eb4f0$export$f0297ce57faf7d71.FilteredData] = 0; - selectedItemIndex[$86b892255d8eb4f0$export$f0297ce57faf7d71.SelectedData] = 0; -} -const $86b892255d8eb4f0$var$shortFormat = (0, $25eae809e43888aa$export$d9468344d3651243)('.2~s'); -function $86b892255d8eb4f0$var$short(n) { - return n === -1 ? '--' : n ? n < 1000 ? n.toString() : $86b892255d8eb4f0$var$shortFormat(n) : '0'; -} -function $86b892255d8eb4f0$export$3fb74a6ae4f1171d(props) { - const dataCount = Object.assign({ - all: -1, - filtered: -1, - selected: -1 - }, props.dataCount); - return props.compact ? (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: (0, $e295d8097c1ad61a$exports).classList('sanddance-datascope', 'compact'), - onClick: props.onCompactClick - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement($86b892255d8eb4f0$var$Compact, Object.assign({}, props, { - dataScopeId: $86b892255d8eb4f0$export$f0297ce57faf7d71.AllData, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectDataSpanAll, - count: dataCount.all - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement($86b892255d8eb4f0$var$Compact, Object.assign({}, props, { - dataScopeId: $86b892255d8eb4f0$export$f0297ce57faf7d71.FilteredData, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectDataSpanFilter, - count: dataCount.filtered - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement($86b892255d8eb4f0$var$Compact, Object.assign({}, props, { - dataScopeId: $86b892255d8eb4f0$export$f0297ce57faf7d71.SelectedData, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectDataSpanSelection, - count: dataCount.selected - }))) : (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: (0, $e295d8097c1ad61a$exports).classList('sanddance-datascope', 'extended', props.active && 'active') - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, props.dataSet), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "datascope-buttons" - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement($86b892255d8eb4f0$var$DataScopeButton, Object.assign({}, props, { - dataScopeId: $86b892255d8eb4f0$export$f0297ce57faf7d71.AllData, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectDataSpanAll, - count: dataCount.all - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement($86b892255d8eb4f0$var$DataScopeButton, Object.assign({}, props, { - dataScopeId: $86b892255d8eb4f0$export$f0297ce57faf7d71.FilteredData, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectDataSpanFilter, - count: dataCount.filtered - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement($86b892255d8eb4f0$var$DataScopeButton, Object.assign({}, props, { - dataScopeId: $86b892255d8eb4f0$export$f0297ce57faf7d71.SelectedData, - text: (0, $d5b6ce321475881f$export$21c51bc433c16634).selectDataSpanSelection, - count: dataCount.selected - }))))); -} -function $86b892255d8eb4f0$var$Compact(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - title: props.text, - onClick: ()=>{ - props.onDataScopeClick(props.dataScopeId); - } - }, $86b892255d8eb4f0$var$short(props.count)); -} -function $86b892255d8eb4f0$var$DataScopeButton(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $f9294a04a77df05a$export$353f5b6fc5456de1), { - themePalette: props.themePalette, - className: (0, $e295d8097c1ad61a$exports).classList('datascope-button', props.selectedDataScope === props.dataScopeId && 'selected'), - disabled: props.disabled, - text: props.text, - onClick: ()=>{ - props.onDataScopeClick(props.dataScopeId); - }, - onRenderText: ()=>{ - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - title: props.count > 0 ? props.count.toString() : '' - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("label", null, props.text), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", null, $86b892255d8eb4f0$var$short(props.count))); - }, - onRenderIcon: ()=>null - }); -} - - - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -function $c8096a1892befafb$export$fcc7818a78919c8c(props) { - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: (0, $e295d8097c1ad61a$exports).classList('scrollable-container', props.className), - role: props.role - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "scrollable" - }, props.children)); -} - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var $2752fa503c160704$export$f3b7566ffe363e3b; -(function(SideTabId) { - SideTabId[SideTabId["ChartType"] = 0] = "ChartType"; - SideTabId[SideTabId["Data"] = 1] = "Data"; - SideTabId[SideTabId["Search"] = 2] = "Search"; - SideTabId[SideTabId["Color"] = 3] = "Color"; - SideTabId[SideTabId["Snapshots"] = 4] = "Snapshots"; - SideTabId[SideTabId["History"] = 5] = "History"; - SideTabId[SideTabId["Transition"] = 6] = "Transition"; - SideTabId[SideTabId["Settings"] = 7] = "Settings"; - SideTabId[SideTabId["Pin"] = 8] = "Pin"; - SideTabId[SideTabId["Collapse"] = 9] = "Collapse"; -})($2752fa503c160704$export$f3b7566ffe363e3b || ($2752fa503c160704$export$f3b7566ffe363e3b = {})); - - - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - - -function $d7542c73853af2f5$export$a8fc19311f33df91(props) { - const selected = !props.closed && props.selectedSideTab === props.sideTabId; - const buttonProps = props.omitAriaSelected ? {} : { - 'aria-selected': selected - }; - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: (0, $e295d8097c1ad61a$exports).classList('vbutton', selected && 'selected') - }, props.badgeText && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "count" - }, props.badgeText), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $baf9c68afdd76912$export$c25acd513dcc8062), Object.assign({}, buttonProps, { - role: props.role || 'tab', - themePalette: props.themePalette, - className: "vbutton", - iconName: props.iconName, - title: props.title, - onClick: ()=>{ - props.onSideTabClick(props.sideTabId); - } - }))); -} - - -function $a4defabaac4a9afe$export$1ba59dacbcbf90fe(props) { - const sidebuttons = [ - { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).ChartType, - iconName: 'BIDashboard', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelChart - }, - { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Color, - iconName: 'Color', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelColor - }, - { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Data, - iconName: 'Table', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelDataBrowser - }, - { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Search, - iconName: 'Search', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSearch - }, - !props.snapshotsHidden && { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Snapshots, - iconName: 'Camera', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelSnapshots - }, - { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).History, - iconName: 'History', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelHistory - }, - { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Transition, - iconName: 'Flow', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelTransition - }, - { - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Settings, - iconName: 'Settings', - title: (0, $d5b6ce321475881f$export$21c51bc433c16634).labelChartSettings - } - ].filter(Boolean); - return (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: (0, $e295d8097c1ad61a$exports).classList('sanddance-sidebar', 'calculator', props.pinned && 'pinned', props.closed && 'closed') - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "sidebar-content" - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $86b892255d8eb4f0$export$3fb74a6ae4f1171d), Object.assign({}, props.dataScopeProps)), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "vbuttons" - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "sidebar-dialogs", - role: 'tablist' - }, sidebuttons.map((sidebutton, i)=>(0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $d7542c73853af2f5$export$a8fc19311f33df91), Object.assign({ - key: i - }, props, sidebutton, { - themePalette: props.themePalette - })))), !props.hideSidebarControls && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "sidebar-controls" - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $d7542c73853af2f5$export$a8fc19311f33df91), Object.assign({}, props, { - omitAriaSelected: true, - role: 'button', - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Pin, - iconName: props.pinned ? 'Pinned' : 'Pin', - title: props.pinned ? (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonToolbarFloat : (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonToolbarDock - })), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $d7542c73853af2f5$export$a8fc19311f33df91), Object.assign({}, props, { - omitAriaSelected: true, - role: 'button', - sideTabId: (0, $2752fa503c160704$export$f3b7566ffe363e3b).Collapse, - iconName: props.closed ? 'DoubleChevronRight12' : 'DoubleChevronLeft12', - title: props.closed ? (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonToolbarShow : (0, $d5b6ce321475881f$export$21c51bc433c16634).buttonToolbarHide - })))), (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $c8096a1892befafb$export$fcc7818a78919c8c), { - role: 'tabpanel' - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "sidetab" - }, props.children)), props.calculating && (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement("div", { - className: "calculating" - }, (0, $a601a4135959dcb0$export$e2253033e6e1df16).react.createElement((0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.Spinner, { - size: (0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.SpinnerSize.large - })))); -} - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ //adapted from https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/fluent-theme/src/fluent/styles/CommandBarButton.styles.ts - -const $c05716ad448a35c4$export$26e7026630023d76 = (props)=>{ - const { theme: theme } = props; - if (!theme) throw new Error('Theme is undefined or null.'); - const { palette: palette, semanticColors: semanticColors } = theme; - const BUTTON_ICON_CLASSNAME = '.ms-Button-icon'; - return { - root: [ - Object.assign({}, (0, $a601a4135959dcb0$export$e2253033e6e1df16).fluentUI.getFocusStyle(theme, { - inset: 2 - })), - { - backgroundColor: palette.white - } - ], - rootHovered: { - backgroundColor: palette.neutralLighter, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDarkAlt - } - } - }, - rootPressed: { - backgroundColor: palette.neutralLight, - color: palette.neutralDark, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootChecked: { - backgroundColor: palette.neutralLight, - color: palette.neutralDark, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootCheckedHovered: { - backgroundColor: palette.neutralQuaternaryAlt, - color: palette.neutralDark - }, - rootExpanded: { - color: palette.neutralDark, - backgroundColor: palette.neutralLight, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootExpandedHovered: { - background: palette.neutralQuaternaryAlt - }, - rootDisabled: { - backgroundColor: palette.white, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: semanticColors.disabledBodySubtext - } - } - }, - splitButtonMenuButton: { - backgroundColor: palette.white, - color: palette.neutralSecondary, - selectors: { - ':hover': { - backgroundColor: palette.neutralLighter, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.neutralPrimary - } - } - }, - ':active': { - backgroundColor: palette.neutralLight, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.neutralPrimary - } - } - } - } - }, - splitButtonMenuButtonDisabled: { - backgroundColor: palette.white - }, - icon: { - color: palette.themePrimary - } - }; -}; - - -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ -const $c0b58eaa2b5865b5$var$s = ` + //#endregion + //#region dist/es6/exportDelimited.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function convertToDelimited(data, delimiter) { + const fields = Object.keys(data[0]); + const file = data.map((row) => { + return fields.map((fieldName) => { + const value = row[fieldName]; + if (typeof value === "number") return value; + if (typeof value === "string") if (value.indexOf(delimiter) >= 0) return `"${value.replace(/"/g, "\"\"")}"`; + else return value; + return ""; + }).join(delimiter); + }); + file.unshift(fields.join(delimiter)); + return file.join("\n"); + } + //#endregion + //#region dist/es6/controls/dataExporter.js + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var exportTypes = [ + ["json", strings.labelExportJSON], + ["csv", strings.labelExportCSV], + ["tsv", strings.labelExportTSV], + ["html", strings.labelExportHTML] + ]; + function _DataExportPicker(_props) { + class __DataExportPicker extends base.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(this.props); + } + getInitialState(props) { + return { + initializer: props.initializer, + dialogHidden: true, + exportType: exportTypes[0][0], + fileName: props.initializer.fileName, + fileNameError: "", + working: false + }; + } + componentDidUpdate() { + if (!deepCompare(this.props.initializer, this.state.initializer)) this.setState(this.getInitialState(this.props)); + } + createExport(exportType, displayName) { + const final = (data) => { + this.props.dataExportHandler(data, exportType, displayName); + this.close(); + }; + const json = JSON.stringify(this.props.data, columnReplacer); + switch (exportType) { + case "json": + final(json); + break; + case "csv": + final(convertToDelimited(JSON.parse(json), ",")); + break; + case "tsv": + final(convertToDelimited(JSON.parse(json), " ")); + break; + case "html": { + const csv = convertToDelimited(JSON.parse(json), ","); + final(embedHtml(`${strings.appName} - ${escape(displayName)}`, embedScript(csv, displayName))); + } + } + } + close() { + this.setState({ + dialogHidden: true, + working: false + }); + } + render() { + const closeDialog = () => this.close(); + if (this.state.delayAction) requestAnimationFrame(() => { + if (this.state.delayAction) { + this.state.delayAction(); + this.setState({ delayAction: null }); + } + }); + const disabled = this.state.working || this.state.dialogHidden; + return base.react.createElement("div", null, base.react.createElement(base.fluentUI.DefaultButton, { + className: "search-action search-bottom-action", + text: strings.buttonExportCount(this.props.data.length), + onClick: () => this.setState({ dialogHidden: false }), + disabled: this.props.disabled + }), base.react.createElement(Dialog, { + hidden: this.state.dialogHidden, + onDismiss: closeDialog, + dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.labelExport + }, + buttons: [base.react.createElement(base.fluentUI.PrimaryButton, { + key: 0, + disabled: disabled || !!this.state.fileNameError, + onClick: (e) => this.setState({ + delayAction: () => this.createExport(this.state.exportType, this.state.fileName), + working: true + }), + text: strings.buttonExport, + iconProps: { iconName: "Download" } + })] + }, base.react.createElement(base.fluentUI.TextField, { + label: strings.labelExportFileName, + onChange: (e, displayName) => { + const displayNameError = getFileNameError(displayName); + this.setState({ + fileName: displayName, + fileNameError: displayNameError + }); + }, + errorMessage: this.state.fileNameError, + value: this.state.fileName + }), base.react.createElement(base.fluentUI.ChoiceGroup, { + className: "sanddance-form-separate", + disabled, + selectedKey: this.state.exportType, + options: exportTypes.map(([exportType, text]) => { + return { + key: exportType, + text, + disabled: false + }; + }), + onChange: (ev, option) => this.setState({ exportType: option.key }), + label: strings.labelExportFormat + }))); + } + } + return new __DataExportPicker(_props); + } + var DataExportPicker = _DataExportPicker; + var illegalChars = "\\/:*?\"<>|"; + function getFileNameError(displayName) { + if (!displayName) return strings.errorExportFilenameEmpty; + for (let i = 0; i < 9; i++) if (displayName.indexOf(illegalChars[i]) >= 0) return strings.errorExportFilenameCharacters(illegalChars); + } + function removeExtensions(fileName) { + exportTypes.forEach(([exportType]) => { + const re = new RegExp(`\\.${exportType}`, "ig"); + fileName = fileName.replace(re, ""); + }); + return fileName; + } + function columnReplacer(name, value) { + if (isInternalFieldName(name, true)) return; + return value === null ? "" : value; + } + function embedScript(csv, displayName, snapshots) { + return ` +